Question: In this assignment you will create a console (standalone) application. This program will allow you to select numbers for the Lucky For Life Lottery game.

In this assignment you will create a console (standalone) application. This program will allow you to select numbers for the "Lucky For Life" Lottery game. For the first 5 numbers you will be requested to enter a number that is greater than zero and less than 49 since the first 5 numbers on the "Lucky For Life" lottery must be between 1- 48. However, theres a catch! Each of these five numbers must be different.

This is what I have done so far:

LuckyForLife.java

import java.util.*;

public class LuckyForLife { int[] winningNumbers = new int[5]; int powerball; //Print the data to Console public void WriteOutput() { System.out.println("Your lucky ball numbers are "); for (int i = 0; i

//Taking Input from Console public void ReadInput() { Scanner sc = new Scanner(System.in); int j = 1; while (true) { System.out.print("Please enter number " + j + " which should be greater than 0 and less than 49: "); int n = sc.nextInt(); //if number is invalid if (n=49) { if (n = 18) { if(p_ball 0) { luckyball = temp; break; } } //Display System.out.println(" The winning numbers are "); for (k = 0; k

_____________________________________________________

LuckyForLifeDemo.java

public class LuckyForLifeDemo { public static void main(String[] args) { // TODO Auto-generated method stub LuckyForLife powerball = new LuckyForLife(); powerball.ReadInput(); powerball.WriteOutput();

} }

__________________________________________________

THIS IS WHAT I NEED HELP WITH:

This is what the program should display at the end.

In this assignment you will create a console (standalone) application. This program

There's something wrong with what I have done so far. When I execute this program, it works all the way up to the "winning numbers" part. It's not displaying the winning numbers even though I have it written in my program. I was wondering if anyone could help me figure out what I've done wrong! Please help! Thank you so much.

A sample of the final output is: is: Your lucky ball numbers are The lucky ball pick is 6 The winning numbers are 30 2? 43 12 46 The winning lucky ball number is 12 You do not have to sort the winning numbers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!