Write/test a Java program regarding the following: A parent registered his/her own child for afterschool club at the local recreation center. There is a standard fee applied to the after school program but there is a late fee added to each minute that the child is picked up late.
The information below states the fee rates
Weekly Fees: $90 Monday thru Friday
Late Fee per minute: $10
The recreation center is open Monday through Friday: 8:00am – 10:00pm
After school club: Monday thou Friday
Drop off times: 7:30am – 8:00am
Pick Up Time: 5:00pm (Late fee applies at 5:01pm)
Perform a billing receipt for the customer that indicates the name of the park employee who received payment as well as date and time payment was made drop off time, pick up time, and whether the parent was charged a late payment.
Name of park: Van Nuys Recreation Center
After school club: Monday - Friday
Time: 7:30am – 8:00am
Date of Payment
Time of Payment
Sales Associate Name: Frodo Baggins
Late Payment Applied? Yes
Drop Off Time: 7:50
Pick up time: 5:10pm
Total bill amount:
Comment of receipt: Note: There was a late payment fee charged for customer
Would you like to make another purchase? (yes or no?)
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.ParseException;
import java.util.Scanner;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class HelloWorld{
private static final DateTimeFormatter dtf =
DateTimeFormatter.ofPattern("dd/yyyy/MM HH:mm:ss");
public static void main(String []args)throws ParseException
{
String time1 = "05:00";
String time2 = "05:10";
int flag;
long amount=0;
Scanner sc=new
Scanner(System.in);
SimpleDateFormat format = new
SimpleDateFormat("HH:mm");
Date date1 =
format.parse(time1);
Date date2 =
format.parse(time2);
System.out.println("\n\nName of
park: Van Nuys Recreation Center");
System.out.println("After school
club: Monday - Friday");
System.out.println("Time: 7:30am to
8:00am");
System.out.println("Pick Up Time:
5:00pm (Late fee applies at 5:01pm)");
System.out.print("Date and time of
Payment: ");
LocalDateTime now =
LocalDateTime.now();
System.out.println(dtf.format(now));
System.out.println("\nSales Associate Name: Frodo Baggins ");
String drop = "7:50";
System.out.println("Drop Off Time: "+drop+" am");
System.out.println("Pick up time: "+time2+" pm");
long difference = (date2.getTime()
- date1.getTime())/60000;
System.out.print("Late Payment
Applied? ");
if(difference>0)
{
System.out.println("Yes ");
System.out.println(difference+"
minute late");
amount=difference*10;
System.out.println("Total bill
amount: "+amount+ "$");
}
else
System.out.println("Total bill
amount: "+amount+ "$");
}
}
Get Answers For Free
Most questions answered within 1 hours.