writerschalet

(Solved) : Java Question Chapter 7 Arrays Ive Done Code Im Still Trouble Inequality Code Import Javau Q36905692 . . .

Java Question where in chapter 7 Arrays. Ive done the code butim still having trouble with the inequality

Need Help Writing an Essay?

Tell us about your assignment and we will find the best writer for your paper.

Get Help Now

Here my code

import java.util.Scanner;public class PS10_5{ public static void main(String args[]) { int[] mynum = new int[5]; int count = 0; int[] lottery = {8,13,27,53,54}; Scanner keyboard = new Scanner(System.in); System.out.println(“Check your lottery numbers here!”); for(int subscript=0; subscript<5; subscript++) { System.out.println(“Enter number ” + (subscript +1) + “:”); mynum[subscript] = keyboard.nextInt(); } for(int subscript=0; subscript<5; subscript++) { for (int winner = 0; winner < 5; winner++) { if (mynum[subscript] == lottery[winner]) { count++; } } } System.out.println(“All set. The winning numbers were: 8 13 27 53 54”); if(count == 5) { System.out.println(“WOW! Grand prize winner!”); } else { System.out.println(“Well, you didn’t win. You got ” + count + ” matching number(s)”); } }}

Here the problem

Write a program that checks to see if the user won the lottery.Assume the winning lottery numbers are 8, 13, 27, 53, and 54. Askthe user for five numbers and compare those numbers to the winningnumbers to determine how many matches the user got. In a lottery,the order of the numbers doesn’t matter.

Here are the required output

Test Case 1

Standard Input               10ENTER20ENTER30ENTER40ENTER50ENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWell, you didn’t win. You got 0 matching number(s)n

Test Case 2

Standard Input               10ENTER20ENTER30ENTER40ENTER8ENTERENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWell, you didn’t win. You got 1 matching number(s)n

Test Case 3

Standard Input               10ENTER53ENTER30ENTER40ENTER8ENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWell, you didn’t win. You got 2 matching number(s)n

Test Case 4

Standard Input               13ENTER53ENTER30ENTER40ENTER8ENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWell, you didn’t win. You got 3 matching number(s)n

Test Case 5

Standard Input               13ENTER53ENTER30ENTER27ENTER8ENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWell, you didn’t win. You got 4 matching number(s)n

Test Case 6

Standard Input               13ENTER53ENTER54ENTER27ENTER8ENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWOW! Grand prize winner!n

Test Case 7

Standard Input               13ENTER53ENTER540ENTER54ENTER27ENTER89ENTER8ENTERENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nMust be between 1 and 99nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWell, you didn’t win. You got 4 matching number(s)n

Test Case 8

Standard Input               100ENTER1000ENTER-1ENTER0ENTER-56ENTER10ENTER20ENTER13ENTER53ENTER54ENTERCheck your lottery numbers here!nEnter number 1:nMust be between 1 and 99nEnter number 1:nMust be between 1 and 99nEnter number 1:nMust be between 1 and 99nEnter number 1:nMust be between 1 and 99nEnter number 1:nMust be between 1 and 99nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWell, you didn’t win. You got 3 matching number(s)n

Test Case 9

Standard Input               53ENTER54ENTER100ENTER1000ENTER-1ENTER0ENTER-56ENTER10ENTER-47ENTER20ENTER13ENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nMust be between 1 and 99nEnter number 3:nMust be between 1 and 99nEnter number 3:nMust be between 1 and 99nEnter number 3:nMust be between 1 and 99nEnter number 3:nMust be between 1 and 99nEnter number 3:nEnter number 4:nMust be between 1 and 99nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWell, you didn’t win. You got 3 matching number(s)n

Test Case 10

To prevent hardcoding, this test case is hidden. To pass thiscase, be sure that all the programming requirements are met.

Test Case 11

Standard Input               13ENTER54ENTER53ENTER27ENTER8ENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWOW! Grand prize winner!n

Test Case 12

Standard Input               54ENTER27ENTER8ENTER13ENTER53ENTERCheck your lottery numbers here!nEnter number 1:nEnter number 2:nEnter number 3:nEnter number 4:nEnter number 5:nAll set. The winning numbers were: 8 13 27 53 54nWOW! Grand prize winner!n

Expert Answer


import java.util.Scanner;

public class PS10_5

{

public static void main(String args[])

{

int[] mynum = new int[5];

int count = 0;

int[] lottery = {8,13,27,53,54};

Scanner keyboard = new Scanner(System.in);

System.out.println(“Check your lottery numbers here!”);

for(int subscript=0; subscript<5;)

{

System.out.println(“Enter number ” + (subscript +1) + “:”);

mynum[subscript] = keyboard.nextInt();

if(!(mynum[subscript] >=1 && mynum[subscript]<=99)) {

System.out.println(“Must be between 1 and 99”);

}else {

++subscript;

}

}

for(int subscript=0; subscript<5; subscript++)

{

for (int winner = 0; winner < 5; winner++)

{

if (mynum[subscript] == lottery[winner])

{

count++;

}

}

}

System.out.println(“All set. The winning numbers were: 8 13 2753 54”);

if(count == 5)

{

System.out.println(“WOW! Grand prize winner!”);

}

else {

System.out.println(“Well, you didn’t win. You got ” + count + “matching number(s)”);

}

}

}
=================================================
SEE OUTPUT, Please Let me know if you face any trouble

PLEASE COMMENT

5 public class PS10_5 public static void main(String args]) int[ mynumnew int[5]; int count0; int[] lottery18,13,27,53,54]; Scanner keyboardnew Scanner(System. in); 10 12 13 14 15 16 17 18 19 20 21 System.out.println(” Check your lottery numbers here!”; for(int subscript-0; subscript-1 && mynum[subscript] <-99)) { System. out.println(“Must be between 1 and 99”); ^else 1 ++subscript; 23 Console X PS10 5 [Java Application] /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/bin/java (15-Apr-2019 Check your lottery numbers here! Enter number 1: 53 Enter number 2: 54 Enter number 3: 100 Must be between 1 and 99 Enter number 3: 1000 Must be between 1 and 99 Enter number 3: Must be between 1 and 99 Enter number 3: 0 Must be between 1 and 99

I lOVE this Professional essay writing website. This is perhaps the fifth time I am placing an order with them, and they have not failed me not once! My previous essays and research papers were of excellent quality, as always. With this essay writing website, you can order essays, coursework, projects, discussion, article critique, case study, term papers, research papers, research proposal, capstone project, reaction paper, movie review, speech/presentation, book report/review, annotated bibliography, and more.

Post your homework questions and get original answers from qualified tutors!

PLACE YOUR ORDER

Share your love