Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming Logic and Design - Lotto This program needs to be corrected. Please

ID: 3602998 • Letter: P

Question

Programming Logic and Design - Lotto

This program needs to be corrected. Please provide such with guidelines given to the right of the data. Thanks.

Your program does not meet the requirements. Please read my comments The MoneyNow Finance Company needs to update their monthly credit card billing process. Use three module that you develop and ifs approach to create this program In the main module declare global variables. Prompt users for user information such as name, the balance, total purchases, etc. . . There should be a module to determine finance charge and interest. The output module should indicate the appropriate billing information such as finance charges, interest, and the new balance. o If the amount subject to finance charge is $250.00 Needed Correction or more, interest must be calculated at 1.5 percent. o If the amount subject to finance charge is less than $250.00, interest is calculated at 1 percent. Variable List Missing Variables Msg1..to tell the user to type in the three numbers Msg2. To display the result message. Step 1: Analysis The goal of the new system is to display the picked number and the Winning Numbers. Variables to be used in the given problem are variables for drawing the balls, unless you Hard-Code them in the logic Data File is missing -3 Data Eike number choice picked number winning number priže money Userno1 Usen02 Useno3 4. pzme0

Explanation / Answer

import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.util.Random;
import javax.swing.JOptionPane;
public class DisplayButtonMessage
{
  
int matches=0;
int loop=0;
public DisplayButtonMessage()
{
  
JFrame frame = new JFrame("Lottery App");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel(new GridLayout(11, 4));
ActionListener al = new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
int arr1[];
arr1=new int[6];
loop++;
int number=0;
int counter;

String num = ((JButton) event.getSource()).getActionCommand();
JOptionPane.showConfirmDialog(null, "Are you sure you want? "+num);
int newNum= Integer.parseInt(num);//Number is now an integer
for(counter=0; counter<1; counter++)
{
Random dice=new Random();
number =dice.nextInt(45);
arr1[counter]=number;
  
System.out.println(arr1[counter]);
if(newNum==arr1[counter])
{
matches++;
}

  
if(loop==6)
{
JOptionPane.showMessageDialog(null,"Now to the Main Draw for a JACKPOT of 5 million!!");
JOptionPane.showMessageDialog(null, "Let's review your matches! ");   
if(matches==0)
{
JOptionPane.showMessageDialog(null, "No matches ! ");   
}
if(matches==1)
{
JOptionPane.showMessageDialog(null, "Just One number, Maybe next time! ");   
}
if(matches==2)
{
JOptionPane.showMessageDialog(null, "You Won a scratch Ticket ");   
}
if(matches==3)
{
JOptionPane.showMessageDialog(null, "You Won 25 euros!");   
}
if(matches==4)
{
JOptionPane.showMessageDialog(null, "You Won 50,000 euros!");   
}   
if(matches==5)
{
JOptionPane.showMessageDialog(null, "You Won 500,00 euros! ");   
}
if(matches==6)
{
JOptionPane.showMessageDialog(null, "You Won The JACKPOT!! ");   
}
}
}
}
};

for (int i = 0; i < 44; i++)
{
JButton b = new JButton("No: " + String.valueOf((i + 1)));
b.setBackground(Color.ORANGE);

b.setActionCommand(String.valueOf((i + 1)));

b.addActionListener(al);
listener for above action Performed  
panel.add(b);
}
frame.add(panel); frame.pack();
frame.setVisible(true);//Sets the frame visible
}
}