Rental Car Application

Rental Car Application

Hi every java master i'm new java beginner and i have to try test one Rental car Application but i can't run it in below this program, hope every java master can help and thank

import java.util.*;

class Car {
        private String make;
        private String model;
        private String regNo;
        private int deposit;
        private int rate;

public Car(String newMake, String newModel, String newRegNo,
                    int newDeposit, int newRate) {
            make = newMake;
            model = newModel;
            regNo = newRegNo;
            deposit = newDeposit;
            rate = newRate;
    }

    public String getMake() {
            return make;
    }

    public String getModel() {
            return model;
    }

    public String getRegNo() {
            return regNo;
    }

    public int getDeposit() {
            return deposit;
    }

    public int getRate() {
            return rate;
    }


}

public class TestProject {
        public static void main(String args[]) {
                List carlist = new ArrayList();
                carlist.add(new Car("Toyota", "Altis", "SJC2456X", 100, 60));
                carlist.add(new Car("Toyota", "Vios", "SJG9523B", 100, 50));
                carlist.add(new Car("Nissan", "Latio", "SJB7412B", 100, 50));
                carlist.add(new Car("Murano", "SJC8761M", "Nissan", 300, 150));
                carlist.add(new Car("Honda", "Jazz", "SJB4875N", 100, 60));
                carlist.add(new Car("Honda", "Civic", "SJD73269C", 120, 70));
                carlist.add(new Car("Honda", "Stream", "SJL5169J", 120, 70));
                carlist.add(new Car("Honda", "Odyssey", "SJB3468E", 200, 150));
                carlist.add(new Car("Subaru", "WRX", "SJB8234L", 300, 200));
                carlist.add(new Car("Subaru", "Imprezza", "SJE8234K", 150, 80));
                Scanner input = new Scanner(System.in);
                System.out.print("Enter model to rent: ");
                String model = input.nextLine();
                (Car s : carlist){
                if (model.equals(s.getModel())) {
                System.out.println("Model " + model + " is available");
                System.out.print("Enter number of days: ");
                int days = input.nextInt();
                                System.out.println("<strong><em>*</em><em>*</em><em>*</em><em>*</strong>Details<strong></em><em>*</em><em>*</em><em>*</em><em>*</em></strong>");
                int cost = (days * s.getRate()) + s.getDeposit();
                System.out.println("Deposit  DailyRate  Duration  TotalCost");
                System.out.println(s.getDeposit() + "       " + s.getRate()+ "            " + days + "        " + cost);
                System.out.print("Proceed to rent?( y/n ): ");
                String dec = input.next();
                if (dec.equals("y")) {
                System.out.println("Enter Customer Name: ");
                String name = input.next();
                System.out.println("Enter IC Number: ");
                int num = input.nextInt();
                        System.out.println("<strong><em>*</em><em>*</em><em>*</strong>Receipt<strong></em><em>*</em><em>*</em>**</strong>");
                System.out.println("Name   ICNo   Car  RegNo Duration   TCost");
                System.out.println(name + "   " + num + "   " + model
                + "   " + s.getRegNo() + "   " + days + "   "+cost);
                System.out.println("Serving Next Customer ");
                } else if (dec.equals("n")) {
                System.out.println("Serving Next Customer: ");
                                }
                        }
                }
        }
}                                   
View Answers

April 5, 2011 at 2:45 PM

import java.util.*;

class Car { private String make; private String model; private String regNo; private int deposit; private int rate;

    public Car(String newMake, String newModel, String newRegNo,
                    int newDeposit, int newRate) {
            make = newMake;
            model = newModel;
            regNo = newRegNo;
            deposit = newDeposit;
            rate = newRate;
    }

    public String getMake() {
            return make;
    }

    public String getModel() {
            return model;
    }

    public String getRegNo() {
            return regNo;
    }

    public int getDeposit() {
            return deposit;
    }

    public int getRate() {
            return rate;
    }

}

public class TestProject {
    public static void main(String args[]) {
    ArrayList<Car> carlist = new ArrayList<Car>();
    carlist.add(new Car("Toyota", "Altis", "SJC2456X", 100, 60));
    carlist.add(new Car("Toyota", "Vios", "SJG9523B", 100, 50));
    carlist.add(new Car("Nissan", "Latio", "SJB7412B", 100, 50));
    carlist.add(new Car("Murano", "SJC8761M", "Nissan", 300, 150));

    carlist.add(new Car("Honda", "Jazz", "SJB4875N", 100, 60)); 
    carlist.add(new Car("Honda", "Civic", "SJD73269C", 120, 70)); 
    carlist.add(new Car("Honda", "Stream", "SJL5169J", 120, 70)); 
    carlist.add(new Car("Honda", "Odyssey", "SJB3468E", 200, 150)); 
    carlist.add(new Car("Subaru", "WRX", "SJB8234L", 300, 200));
    carlist.add(new Car("Subaru", "Imprezza", "SJE8234K", 150, 80));
    Scanner input = new Scanner(System.in);
    System.out.print("Enter model to rent: ");
    String model = input.nextLine();
    for(Car s : carlist){
        if (model.equals(s.getModel())) {
            System.out.println("Model " + model + " is available");
            System.out.print("Enter number of days: ");
            int days = input.nextInt();
            System.out.println("****Details****");
            int cost = (days * s.getRate()) + s.getDeposit();
            System.out.println("Deposit DailyRate Duration TotalCost"); 
            System.out.println(s.getDeposit() + " " + s.getRate()+ " " + days + " " + cost);
            System.out.print("Proceed to rent?( y/n ): ");
            String dec = input.next();
            if (dec.equals("y")) {
                System.out.println("Enter Customer Name: "); 
                String name = input.next(); 
                System.out.println("Enter IC Number: ");
                int num = input.nextInt();
                System.out.println("***Receipt****");
                System.out.println("Name ICNo Car RegNo Duration TCost");
                System.out.println(name + " " + num + " " + model + " " + s.getRegNo() + " " + days + " "+cost);
                System.out.println("Serving Next Customer ");
                } 
                else if (dec.equals("n")) {
                    System.out.println("Serving Next Customer: ");
                    } 
                    }
                    }
                    } 
                    }

April 5, 2011 at 5:59 PM

Thank a lot For helping









Related Tutorials/Questions & Answers:
Rental Car Application
Rental Car Application   Hi every java master i'm new java beginner and i have to try test one Rental car Application but i can't run it in below...*; class Car { private String make; private String model
Rental Car Application
Rental Car Application   Hi every java master i'm new java beginner and i have to try test one Rental car Application but i can't run it in below... import java.util.*; class Car { private String make; private
Advertisements
How to Create Car Rental Application in Java ?
How to Create Car Rental Application in Java ?  Hi, How to Create a Car Renal Application using Java to Check the Car renting, booking... the car rental apps in Java
Car Rental Application in Java
Car Rental Application in Java In this section, we are going to create a Java application regarding car renting, booking and checking the availability of vehicles. For this application we have stored some model names, their registration
Agra same day car rental
Agra same day car rental  Hi, I want to see the Taj Mahal but just wondering where to book car on rental for the same day trip to Taj Mahal? Thanks
Car Rentals in Delhi
so that you can stop and go at your will? You must be looking for a car rental... of the travelers. If someone is traveling with his family a car rental is a good... your traveling needs and you need to opt for coach rental. The car rentals
Car Rentals in Jaipur
. These tourists look for a car rental in Jaipur so that they can understand the city... a car rental facilitates them to get access of different tourist attractions..., Govinddev Ji Temple, Albert Hall Museum and many more. A Jaipur car rental will take
ModuleNotFoundError: No module named 'scooter-rental'
ModuleNotFoundError: No module named 'scooter-rental'  Hi, My... named 'scooter-rental' How to remove the ModuleNotFoundError: No module named 'scooter-rental' error? Thanks   Hi, In your python
Rental Code GUI - Java Beginners
Rental Code GUI  dear sir... i would like to ask some code of java GUI form that ask the user will choose the menu to input Disk #: type...: then the second windows will display the Rental Rental #: no. of items rented: date
ModuleNotFoundError: No module named 'car'
ModuleNotFoundError: No module named 'car'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'car' How to remove the ModuleNotFoundError: No module named 'car' error
ModuleNotFoundError: No module named 'car'
ModuleNotFoundError: No module named 'car'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'car' How to remove the ModuleNotFoundError: No module named 'car' error
ModuleNotFoundError: No module named 'craigslist-rental-market'
ModuleNotFoundError: No module named 'craigslist-rental-market'  Hi...: No module named 'craigslist-rental-market' How to remove the ModuleNotFoundError: No module named 'craigslist-rental-market' error? Thanks  
ModuleNotFoundError: No module named 'odoo8-addon-sale-rental'
ModuleNotFoundError: No module named 'odoo8-addon-sale-rental'  Hi...: No module named 'odoo8-addon-sale-rental' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-sale-rental' error? Thanks   
ModuleNotFoundError: No module named 'odoo9-addon-sale-rental'
ModuleNotFoundError: No module named 'odoo9-addon-sale-rental'  Hi...: No module named 'odoo9-addon-sale-rental' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-sale-rental' error? Thanks   
ModuleNotFoundError: No module named 'scrapy-tw-rental-house'
ModuleNotFoundError: No module named 'scrapy-tw-rental-house'  Hi...: No module named 'scrapy-tw-rental-house' How to remove the ModuleNotFoundError: No module named 'scrapy-tw-rental-house' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo10-addon-sale-rental'
ModuleNotFoundError: No module named 'odoo10-addon-sale-rental'  Hi...: No module named 'odoo10-addon-sale-rental' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-sale-rental' error? Thanks  
ModuleNotFoundError: No module named 'craigslist-rental-market'
ModuleNotFoundError: No module named 'craigslist-rental-market'  Hi...: No module named 'craigslist-rental-market' How to remove the ModuleNotFoundError: No module named 'craigslist-rental-market' error? Thanks  
dvd rental system - Java Beginners
dvd rental system  i am a young female who just got attracted by the java ptogramming and as i am now learning this, java is geting complecated evey day, now i looking for help with my java project. my project is about keeping
car licensing office
car licensing office  *A customer who wants to apply for getting a car license should provide information about the brand of the car... of the car, the request is sent to one of the employees. *After receiving all
car licensing office
car licensing office  *A customer who wants to apply for getting a car license should provide information about the brand of the car... of the car, the request is sent to one of the employees. *After receiving all
car licensing office
car licensing office  *A customer who wants to apply for getting a car license should provide information about the brand of the car... of the car, the request is sent to one of the employees. *After receiving all
car rent system project
car rent system project  pl, may I get a source code in java with user inter face about car rent system. if it is possible pl help me.   import java.util.*; class Car { private String make; private String model
Delhi to Udaipur by car
Delhi to Udaipur by car  Hi, I'll drive my car from Delhi to Udaipur. So, please suggest me the shortest way... thanks
How to insert a car in the picture, insert a car in the picture, insert a car
How to insert a car in the picture   ... and a car to insert.ADS_TO_REPLACE_1   ADS_TO_REPLACE_2 Paste: Copy the car picture and paste on the road picture as here. Decrease size: Press Ctrl
java Application Convert to java Applet
{ System.out.print("\n"); System.out.println(" Thank survey to Rental Car System...("**Rental Car Charges**"); System.out.println("Vehicle type= Car"); if(day>0...java Application Convert to java Applet  Hi every Java Masters i'm
ModuleNotFoundError: No module named 'my-car'
ModuleNotFoundError: No module named 'my-car'  Hi, My Python...-car' How to remove the ModuleNotFoundError: No module named 'my-car'... to install padas library. You can install my-car python with following command
ModuleNotFoundError: No module named 'car_package'
ModuleNotFoundError: No module named 'car_package'  Hi, My Python... 'car_package' How to remove the ModuleNotFoundError: No module named 'car_package' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'ddc-car'
ModuleNotFoundError: No module named 'ddc-car'  Hi, My Python...-car' How to remove the ModuleNotFoundError: No module named 'ddc-car... to install padas library. You can install ddc-car python with following command
ModuleNotFoundError: No module named 'demo-car'
ModuleNotFoundError: No module named 'demo-car'  Hi, My Python... 'demo-car' How to remove the ModuleNotFoundError: No module named 'demo-car... to install padas library. You can install demo-car python with following
ModuleNotFoundError: No module named 'my-car'
ModuleNotFoundError: No module named 'my-car'  Hi, My Python...-car' How to remove the ModuleNotFoundError: No module named 'my-car'... to install padas library. You can install my-car python with following command
java Application to java Applet
quit = false; do{ System.out.println(" Welcome to Rental Car System...(); System.out.print("\n"); System.out.println("Rental Car Charges"); System.out.println...{ System.out.print("\n"); System.out.println(" Thank survey to Rental Car System and See
Photoshop Tutorial : Cartoon Car
How to design a cartoon car.       The designing of a cartoon car is not difficult at all. This article will teach you to design a cartoon car. I have tried to make this a simple
GPS Car
GPS Car       GPS Car Navigation System Have you ever settled behind the wheel of your car... (Global Positioning System) car navigation systems can show and even tell you
ModuleNotFoundError: No module named 'dk-car-scraper'
ModuleNotFoundError: No module named 'dk-car-scraper'  Hi, My... named 'dk-car-scraper' How to remove the ModuleNotFoundError: No module named 'dk-car-scraper' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'trec-car-tools'
ModuleNotFoundError: No module named 'trec-car-tools'  Hi, My... named 'trec-car-tools' How to remove the ModuleNotFoundError: No module named 'trec-car-tools' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ybc-car-recognition'
ModuleNotFoundError: No module named 'ybc-car-recognition'  Hi, My... named 'ybc-car-recognition' How to remove the ModuleNotFoundError: No module named 'ybc-car-recognition' error? Thanks   Hi
ModuleNotFoundError: No module named 'car_wash_queueing'
ModuleNotFoundError: No module named 'car_wash_queueing'  Hi, My... named 'car_wash_queueing' How to remove the ModuleNotFoundError: No module named 'car_wash_queueing' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'Coversation-With-Your-Car'
ModuleNotFoundError: No module named 'Coversation-With-Your-Car'  Hi...: No module named 'Coversation-With-Your-Car' How to remove the ModuleNotFoundError: No module named 'Coversation-With-Your-Car' error? Thanks  
ModuleNotFoundError: No module named 'dk-car-scraper'
ModuleNotFoundError: No module named 'dk-car-scraper'  Hi, My... named 'dk-car-scraper' How to remove the ModuleNotFoundError: No module named 'dk-car-scraper' error? Thanks   Hi, In your python
Delhi to Agra Tour by Car
Delhi to Agra Tour by Car Most of the tourists who visit Delhi also want... prefer a package from Delhi to Agra Tour by car as it offers them freedom... cities is about 200 km hence a car trip could be a better option to explore
Agra Car Hire
Agra Car Hire While going for a trip to Agra most of the tourists and vacationers go for a car hire for Agra, as it offers freedom to travel... to the tourists, a car trip to Agra is most sought after way to visit the city
car - Framework
can modify this application connection with database
to Rental Car System"); lab.setBounds(100,20,200,20); add(lab); label1 = new...,"Thank survey to Rental Car System and See you Again....!"); } } } else...{ JOptionPane.showMessageDialog(null,"Thank survey to Rental Car System and See you Again
How to draw a bullet spot on the car, draw a bullet spot on the car, draw a bullet spot
How to draw a bullet spot on the car       This example has a technique to draw a bullet spot... a car picture.ADS_TO_REPLACE_1 Circle: Draw a circle with "5d6780"
Same Day Agra Trip by Car
Same Day Agra Trip by Car Want to explore the city of Agra from Delhi... to explore this destination but hiring a car gives you much freedom... at your will. Same day Agra trip by car has various advantages of its own
Car Music Streaming via iPhone Bluetooth, iphone Bluetooth Audio Streaming
Stream iPhone Music in Car Using Bluetooth One of the nicest features... the iPhone to the Car audio using Bluetooth. If your car has a supported Bluetooth... unobtrusively. Now the only problem that remains?finding a car device that supports
How to design a tomato patch on your car
How to design a tomato patch on your car This tutorial will help you to insert a tomato patch on the bonnet of the car, this effect has... car picture. ADS_TO_REPLACE_1 Make a patch shape: Choose "bb352a"
Downloading and Installing Apache Geronimo Application Server
Downloading and Installing Apache Geronimo Application Server  ... Geronimo Application Server on our development environment. The Apache Geronimo Application Server comes in the zip and tar file format. Its very easy to install
Swing application
Swing application  Hello, I want to develop a Swing application... the application not through web browsers, instead through a Swing desktop application GUIs. Please help me to develop such an application
web application
web application  what is lazy loading in web based application

Ads