Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Rental Car Application
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


vincent mon
Rental Car Application
2 Answer(s)      3 years and 9 months ago
Posted in : Java Beginners


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: ");
                                }
                        }
                }
        }
}                                   

Advertisement
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..., Albert Hall Museum and many more. A Jaipur car rental will take you
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
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       This is very interesting example because you will learn here... and a car to insert.   Paste: Copy the car picture and paste
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
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
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... is about 200 km hence a car trip could be a better option to explore the city
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
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
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. Circle: Draw a circle with "5d6780" color
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 and comfort... will. Same day Agra trip by car has various advantages of its own kind. First
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. Make a patch shape: Choose "bb352a" color and Pen
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
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
web application
web application  what is lazy loading in web based application
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
bank application
bank application  hello sir I got the simple bank application project which is very useful but I want the database for this project kindly send me database for this simple online bank application
Advertisements
 

 

 

DMCA.com