Write a JAVA procedural program that works out the amount a person has to pay for parking in a car park in a tourist town. If they say they are disabled, they are told it is free. Otherwise they enter the number of hours as a whole number (1-8) that they wish to park as well as whether they have an “I live locally” badge or are an old age pensioner both of which leads to a discount. The program tells them the cost to park. The calculation is done in this program as follows. If they are disabled it is free. Otherwise … Take number of hours they wish to park and give a basic charge: • 1 hour: 3.00 pounds • 2-4 hours: 4.00 pounds • 5-6 hours: 4.50 pounds • 7-8 hours: 5.50 pounds Next modify the resulting charge based on whether they are local or not: • If local: subtract 1 pound • If OAP: subtract 2 pounds

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a JAVA procedural program that works out the amount a person has to pay for parking in a car
park in a tourist town. If they say they are disabled, they are told it is free. Otherwise they enter the number
of hours as a whole number (1-8) that they wish to park as well as whether they have an “I live locally”
badge or are an old age pensioner both of which leads to a discount. The program tells them the cost to park.
The calculation is done in this program as follows. If they are disabled it is free. Otherwise … Take number
of hours they wish to park and give a basic charge:
• 1 hour: 3.00 pounds
• 2-4 hours: 4.00 pounds
• 5-6 hours: 4.50 pounds
• 7-8 hours: 5.50 pounds
Next modify the resulting charge based on whether they are local or not:
• If local: subtract 1 pound
• If OAP: subtract 2 pounds
Your program MUST include methods including ones that
- asks for the hours and returns the basic charge.
- asks whether they live locally / are an OAP and returns the amount to subtract.

  • EXPLAIN HOW YOUR PROGRAM WORKS
  • Write a program that uses if-then-else statements
  • Write a program that is split in to methods and includes methods that return a result
  • Write a program that includes useful comments, at least one per method saying what it does. 
  • Write a program that uses indentation in a way that makes its structure clear. 
  • Provide commenrted code with explanation in every step

Below you will find an example run of the program and the template that you should follow when creating the program.

import java.util.Scanner; // Needed to make Scanner available
class name // change the name to something appropriate
{
public static void main (String [] a)
{
method_call ); //Change this to a call to the method doing the work
System.exit(0);
}
// Add all methods the program uses here
}
Transcribed Image Text:import java.util.Scanner; // Needed to make Scanner available class name // change the name to something appropriate { public static void main (String [] a) { method_call ); //Change this to a call to the method doing the work System.exit(0); } // Add all methods the program uses here }
An example run of the program (words in bold are typed by the user: pop-up boxes may be used for I/O):
Are you disabled? Yes
Parking for you is free
Another example run:
Are you disabled? No
How many hours do you wish to park (1-8) ? 5
Do you have an "I live locally badge"? Yes
Are you an OAP? Yes
The parking charge for you is 1.50 pounds.
Another example run:
Are you disabled? No
How many hours do you wish to park (1-8) ? 1
Do you have an "I live locally badge"? Yes
Are you an OAP? No
The parking charge for you is 2 pounds.
Transcribed Image Text:An example run of the program (words in bold are typed by the user: pop-up boxes may be used for I/O): Are you disabled? Yes Parking for you is free Another example run: Are you disabled? No How many hours do you wish to park (1-8) ? 5 Do you have an "I live locally badge"? Yes Are you an OAP? Yes The parking charge for you is 1.50 pounds. Another example run: Are you disabled? No How many hours do you wish to park (1-8) ? 1 Do you have an "I live locally badge"? Yes Are you an OAP? No The parking charge for you is 2 pounds.
Expert Solution
steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY