Call
(317)643-0663
for consultation
Experience Programming
.
Home
Pricing
About
Contact
Java Example
Simple Parking Garage Example
.
Back to Examples
package edu.iuk.Parking;
import javax.swing.JOptionPane;
public class Parking {
public static void main(String[] args) {
// Jacob Morris
int Hours;
double parkingCost = 0;
Hours = Integer
.parseInt(JOptionPane.showInputDialog(“Please enter number of hours parked.\n If parked for a fraction of an hour, please round up.”));
if (Hours <= 3) {
parkingCost = 2;
} else if (Hours > 3) {
parkingCost = (Hours * .5) + .5;
}
if (parkingCost > 10) {
parkingCost = 10;
}
JOptionPane.showMessageDialog(null, “You owe the parking garage $” + parkingCost + “0.\n Thank you!”);
}
}
Back to Examples
Startup Discount
Small Business?
Contact us for an
Enormous
Discount!
Contact Us Today!