Objective: The objective of this lab is to get familiar with the syntax of the Java programming language. This lab is designed to reinforce programming concepts.
Instructions:
Description of the Problem.
A parking garage charges a $2.00 minimum fee to park for up to
three hours. The garage charges an additional $0.50 per hour for
each hour or part thereof in excess of three hours. The maximum
charge for any given 24-hour period is $10.00. Assume that no car
parks for longer than 24 hours at a time.
Write a Java application that calculates and displays the parking
charges for each customer who parked in the garage yesterday. You
should enter the hours parked for each customer. The program should
display the charge for the current customer and should calculate
and display the running total of yesterday’s receipts. The program
should use the method calculateCharges to determine the charge for
each customer.
Sample Output
Enter number of hours (a negative to quit): 2
Current charge: $2.00, Total receipts: $2.00
Enter number of hours (a negative to quit): 10
Current charge: $5.50, Total receipts: $7.50
Enter number of hours (a negative to quit): -1
// do comment if any problem arises
//code
import java.util.Scanner;
class charge {
public double get_charge(int hours) {
// if car is parked for 10 hours
if (hours == 24)
return 10.00;
// initail charge of 2$
double charge = 2.00;
// if car has been parked for greater than 3 hours
if (hours > 3)
charge += (hours - 3) * 0.5;
return charge;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double total = 0;
// create a temporary object
charge temp = new charge();
while (true) {
// read number of hours from user
System.out.print("Enter number of hours (a negaitve to quit): ");
int hours = sc.nextInt();
// if user enters -ve break
if (hours < 0)
break;
// calculate charge for given hours and display
double current_charge = temp.get_charge(hours);
total += current_charge;
System.out.println("Current charge: $" + current_charge + ", Total reciepts: $" + total);
}
}
}
Output:

Objective: The objective of this lab is to get familiar with the syntax of the Java...
Write a C++ console application that calculates and displays the charges for multiple customers using a parking garage. The parking garage charges a minimum fee of $3.00 to park for up to three hours. The garage charges an additional $0.85 per hour or fraction of an hour for parking over three hours. The maximum charge for any given 24-hour period is $20.00. You may assume that no car parks for longer than 24 hours at a time. Your program will...
A parking garage has 5 customers daily. The garage charges a $5.00 minimum fee to park up to two hours. The garage charges an additional $1.00 per hour for each hour (or part of an hour) over two hours. The maximum charge for any given day is $12.00. All cars are gone by midnight. Write a program to calculate and print a summary of the charges for a day. For input the program will read the hours of usage for...
A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour in excess of these initial three hours. The maximum charge for any given 24 hour period is $10.00. Assume no car parks for longer than 24 hours at a time. Write a program that calculates and prints the total parking charges for the customers who parked their cars in this garage (at least 4 cars) and the...
Write a program in C An international airport offers long term parking at the following rates: First 60 minutes is free; 61-80 minutes $4; Each additional 20 minutes $2; And $18 max. per day (24 hours). Write a program longterm_parking.c that calculates and prints the charges for parking at the long term parking garage. 1. The user enters the number of total hours and minutes; the program prints the charge. 2. If the input is invalid, print a message and...
write in java and you must use methods.... Part I Internet Service Provider An Internet service provider has three different subscription packages for its customers: Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour. Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour. Package C: For $19.95 per month unlimited access is provided. Write a program that calculates a customer’s monthly bill....
Write a Java application that determines whether any of several department store customers has exceeded the credit limit on a charge account. For each customer, the following facts are inputted: Account number Balance at beginning of month Total amount of all items charged by the customer this month Total amount of all credits applied to the customer’s account this month Allowed credit limit Use the value of -1 as a sentinel value to quit the program. The program should input...
in java PART ONE ================================================== Write a program that will read employee earnings data from an external file and then sort and display that data. Copy and paste the input file data below into an external file, which your program will then read. You will want to use parallel arrays for this program. Modify the select sort algorithm to receive both arrays as parameters as well as the size of the arrays. Use the algorithm to sort your earnings array....
Write a Java application that determines whether any of several department store customers has exceeded the credit limit on a charge account. For each customer, the following facts are inputted: -Balance at beginning of month -Total amount of all items charged by the customer this month -Total amount of all credits applied to the customer’s account this month -Allowed credit limit Use the value of -1 as a sentinel value to quit the program. The program should input all these...
PART TWO Write a program which will populate an integer ArrayList with user input, and then provide a menu of various operations to perform on that ArrayList. The first step is to have the user push a bunch of integers into a ArrayList. The second step is to perform various operations on that ArrayList. Your input must be in the format below. The user can enter either a positive integer or -99 to quit. The menu to present is: Sum...
I need help with this java project and please follow the instruction below. thank Class Project - Parking Ticket simulator Design a set of classes that work together to simulate a police officer issuing a parking ticket. Design the following classes: • The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are as follows: – To know the car’s make, model, color, license number, and the number of minutes that the car has been parked. • ...