A parking garage has two types of customers: members and non-members. During week working days, Sunday to Thursday, members use the parking for free and non-members pay BD 0.300 per hour. However, during the weekend, Friday and Saturday, all type of customers pay BD 0.200 per hour. Write a Java program that prompts the user to enter a day (int) followed by the number of parking hours double) and a member code (char) 'M' or 'm' for members and any other character for non-menmbers. Your program should then calculate and print the total charges. For the days, use 1 for Sunday, 2 for Monday, etc. Note: For any invalid day or hours print an appropriate invalid message and exit the program. Sample Run 1 Sample Run 2 Sample Run 3 Enter day, hours and member code: 6 4.5 M Enter day, hours and member code; 2 5.0 M Enter day, hors and member code: 3 5.25 N Total charges: BD 0,900 Total charges: BD 0.000 Tolal charges: BD 1575

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 9PE
icon
Related questions
Topic Video
Question
Java 1
A parking garage has two types of customers: members and non-members. During week working days, Sunday to
Thursday, members use the parking for free and non-members pay BD 0.300 per hour. However, during the weekend,
Friday and Saturday, all type of customers pay BD 0.200 per hour.
Write a Java program that prompts the user to enter a day (Int) followed by the number of parking hours (double)
and a member code (char) 'M' or 'm' for members and any other character for non-members. Your program should
then calculate and print the total charges. For the days, use 1 for Sunday, 2 for Monday, etc. Note: For any invalid
day or hours print an appropriate invalid message and exit the program.
Sample Run 1
Enter day, hours and member code:
6 4.5 M
Sample Run 2
Sample Run 3
Enter day, hours and member code;
2 5.0 M
Enter day, hours and member code:
3 5.25 N
Total charges: BD 0,900
Total charges: BD 0.000
Total charges: BD 1.575
bers
mem ber
non- n m
M
free
howA メo3~
charges
larges
Transcribed Image Text:A parking garage has two types of customers: members and non-members. During week working days, Sunday to Thursday, members use the parking for free and non-members pay BD 0.300 per hour. However, during the weekend, Friday and Saturday, all type of customers pay BD 0.200 per hour. Write a Java program that prompts the user to enter a day (Int) followed by the number of parking hours (double) and a member code (char) 'M' or 'm' for members and any other character for non-members. Your program should then calculate and print the total charges. For the days, use 1 for Sunday, 2 for Monday, etc. Note: For any invalid day or hours print an appropriate invalid message and exit the program. Sample Run 1 Enter day, hours and member code: 6 4.5 M Sample Run 2 Sample Run 3 Enter day, hours and member code; 2 5.0 M Enter day, hours and member code: 3 5.25 N Total charges: BD 0,900 Total charges: BD 0.000 Total charges: BD 1.575 bers mem ber non- n m M free howA メo3~ charges larges
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT