Question: help me correct this code: import javax.swing.JOptionPane; public class RentalDemo { private static int minutes; public static void main ( String [ ] args )

help me correct this code: import javax.swing.JOptionPane;
public class RentalDemo {
private static int minutes;
public static void main(String[] args){
Rental rentals[]= new Rental[4];
for (int i =0; i < rentals.length; i++){
String contactNumber = JOptionPane.showInputDialog(null, "Enter contract number: ", "Sammy's Seashore Supplies", 3);
rentals[i]= new Rental(contactNumber, minutes);
int minutes =0;
while (minutes <60|| minutes >7200){
minutes = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter the number of minutes (60-7200): ", "Sammy's Seashore Supplies", 3));
}
String output = "Contract Number: "+ rentals[i].getContractNumber();
output = output +"
Time: "+ rentals[i].getHours()+" hours and "+ rentals[i].getMinutes()+" minutes";
output = output +"
Total Price: $"+ rentals[i].getPrice();
JOptionPane.showMessageDialog(null, output, "Sammy's Seashore Supplies", 1);
if (i ==2){
int hours = rentals[2].getHours();
for (int j =0; j < minutes; j++){
JOptionPane.showMessageDialog(null, "Coupon good for 10 percent off next rental", "Sammy's Seashore Supplies ",1);
}
}
}
}
}

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!