Jump to content

Fervor

Members
  • Content Count

    1
  • Donations

    $0.00 
  • Joined

  • Last visited

Community Reputation

1 Neutral

About Fervor

  • Rank
    Newbie
  1. Hello everyone, I am stuck with these java instruction. I tried my best, but couldn't come up with the right codes. Could someone looks into this, and maybe could write the code for me, Thank in advance. Programming Projects: 2. Write a program that asks the user to input a single letter and displays the corresponding digit on a telephone. The letters and digits on a telephone are grouped this way: 2=ABC4=GHI6=MNO8=TUV 3=DEF5=JKL7=PQRS9=WXYZ Continue asking user to enter the letter until any non alphabetic character is entered. Also, the program should treat the entered lowercase letter as the corresponding uppercase letter. The screen dialog might look like this: Enter a single letter: C The digit 2 corresponds to the letter C on the telephone. Enter a single letter: S The digit 7 corresponds to the letter S on the telephone. Enter a single letter: u The digit 8 corresponds to the letter U on the telephone. Enter a single letter: L The digit 5 corresponds to the letter L on the telephone. Enter a single letter: a The digit 2 corresponds to the letter A on the telephone. Enter a single letter: 9 Bye! (Hints: use a loop. Also use either if-else if-else selections or switch statements in the loop. Refer to the program PickEmployee.java) 3. (Lewis & Loftus, PP5.8) Design and implement an application that simulates a simple slot machine in which three numbers between 0 and 9 are randomly selected and printed side by side. Print an appropriate statement if all three of the numbers are the same, or if any two of the numbers are the same. Continue playing until the user chooses to stop. Your output would be like C:\cis283>java SimpleSlot 975 play again (y/n)? y 480 play again (y/n)? y 555 Jackpot!!! play again (y/n)? y 622 Matched 2!! play again (y/n)? n C:\cis283> (Hints: Use if-else inside a loop. Use nextInt() method of the Random class to generate three numbers individually.) 4. Write a program to ask the user to input an integer for the number of lines. Then use nested loops to print the following output (Assume the user entered 6.): 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
×