• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
CSC 201Computer Science – IHomework – 3Out: Sunday, Nov 1st 2009Due: Sunday, Nov 15
th
2009
Instructions1)All the Homeworks are individual assignments. No group work allowed.
2)
This electronic version of this assignment is due Nov 15
th
10:00AM(Sunday).3)Please include proper comments in your programs.4)If it is a programming assignment, you would need to submit both electroniccopy (to pgundamraju@nvcc.edu) and a hard copy. Same timings apply forboth the submissions.5)Non-submission of homework electronically OR manually will result in a ‘0’in that homework.6)Please read and understand the Cheating Policy mentioned in the courseoutline document.7)Any questions/concerns should be directed to the Professor.8)I recommend students to start working on the assignment as early aspossible.Total: 50 PointsQuestion:Algorithm: 10 pointsCode/Program: 40 points
Programming Assignment – 3 simulates ‘Java Classes’. For the below assignment welearn to create/design our own data type.Write an
algorithm
and a
 Java Program
for the below scenario:We simulate a Car Reservation System where in users of this system can check theavailability of a car and reserve it. The end-user will be presented with 3 options:1) View cars2) Reserve car3) Exit the system.There are two types of customers: Preferred (P) and Normal Customers (N).
 
Scenario 1: View cars
When either user (Preferred or Normal customers) enters option ‘1’, he can view a list of all the cars and their availability. Your output should look something like below.Car NameAvailabilityMemberCodeCar1TruePCar2TruePCar3TrueNCar4TrueNThe carName variable is of datatype String.The availability variable is of data type Boolean.The MemberCode variable is of datatype String.
Scenario 2: Reserve Car
When either user enters option ‘2’, user has the ability to reserve a car. But a normalcustomer with member code = N cannot reserve a car whose member code = ‘P’.A preferred customer can reserve cars with either of the member code i.e ‘P’ or ‘N’.
Scenario 3: Exit
When user enters option ‘3’, just break out from the system and your program should endrunning. _______________________________________________________________________  _ Below is the skeleton I have designed. Students are free to design their own program.import scanner class;class car { bavailability;String member_code;String car_name;car(String name, String code){}
 
 boolean getAvailability(String name){} public String getCarName(){} public String getMemberCode(){}void displayAllCars(){}void reserveCars(String name){}}Class carrental{ public static void main(String[] args){System.out.println(“Hello, Welcome to ABC car Rental company”);Scanner s = new Scanner(System.in);car[] carobj = new car[3];// Students are encouraged to take a sample of more than 10 cars
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...