Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

arrays of objects and enumurated types  RSS feed

Dounia Kchiere
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi programming experts,
I am a very beginner in Java!!
I have problems working on my first project of java that consits of travel agency. At that level I need to work on cars reservation in which the client has to choose a class of cars(economic, luxury, etc) and in my program I need to return an array of cars(objects) that are available. Therefore, do I have to create classes of economic, luxury, etc that contain an array of cars available then return it to the client. Or can I just have economic, luxury as ennumerated types!!
Here is the class I am working on currently:

public class CarAgency {
public enum CarCathegories{

String name;
String Address;

boolean AvailabeClassCars(String choice){//looks for the class of car the travel agency asked for and returns
// the list of cars available
switch (choice){
case "luxuary":return true; break;
case "economic":return true; break;
case "sport": return true; break;
String[] startDate(){//gets the pick up date of the car from the travel agency

String[] EndDate(){//gets the return date of the car from the travel agency

boolean isAvailable(String carClass){//returns wether the car agency has cars of a certain class


float DailyPriceOfCar(Car c ){ //it returns the price of the car chosen per day

float totalCost(int duration, float cost){

public static void main(String[] args) {
CarAgency caragency = new CarAgency();

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!