Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

please need help with the java program

A micro car rental company.

package yourLastName.cis4110.assignment5;

Please create an enum type, say Cartype, featuring all rental car types -- SUBCOMPACT, COMPACT, MIDSIZE, FULLSIZE

(You may put the enum definition in Car class)

class Car

Instance variables:

- private String plateNum

- private Cartype carType

- private boolean availability

Member methods:

- Please define all setters and getters

class RentACar - This is a five car system for prototyping

instance variables:

- Car rentalCars[5] //a constant size so that you don't have to worry about handling the flexible size of the array.

member methods:

- public void setRentalCars(Car[] rentalcars) // array as a formal param

- public Car[] getRentalCars() //array as a return type; pay attention to deep copy

- public String rentACar(cartype) // eg. rentACar(Car.cartype.COMPACT);

return plateNum if available, otherwise null or empty string "" //search through the rental car list and find the first available car of the type matching the argument; //Please note, once the car is rented, the car's availability should be set to false or 0.

-returnACar(platNum) //Reset the car's availability to true

classManageCars// or any name if you'd like. Put your main() function here to test your program.

In your main()

1). You may manually create five Car objects here, say Car[] myRentalCars = new Car[5]. No need to use Scanner to ask user to input data to save time. e.g.: You may directly put - rentalCar[0] = new Car(); rentalCar[0].setPlateNum("P1"); rentalCar[0].setCarSize(Car.rentalcar.COMPACT); rentalCar[0].setAvailability(true); or using a Car constructor of three parameters e.g.: new Car("P1", Car.rentalcar.COMPACT,1);

2). Create a CarRental object, say myRental

3) myRental.setRentalCars(myRentalCars);

4) Put a few calls to rentACar() and returnACar() of myRental to test your program. e.g.: myRental.rentACar(Car.cartype.COMPACT); myRental.rentACar(Car.cartype.MIDSIZE); myRental.returnACar("PlateNo1");

To add any additional properties, methods if necessary

Java, Programming

  • Category:- Java
  • Reference No.:- M93086412

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As