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



Home Answers Viewqa Java-Beginners Rental Car Application

Have Programming Question? Ask it here!
 
 
 


vincent mon
Rental Car Application
2 Answer(s)      3 years and 4 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
Hibernate application
Hibernate application   Hi, I am using Netbeans IDE.I need to execute a **Hibernate application** in Netbeans IDE.can any one help me to do
jsp application
jsp application  write a jsp application that will receive an integer from the client , check if the integer is even or odd and send the result to the client
struts application
struts application  hi, how to retrive data from databse in struts application aand send the retrived data to corresponding form
web application
web application  Dear friend, could u plz tell me wats difference bt web server,application server,container with thanks praveen
registration application
registration application  How to develop a registration application in struts which has seperate file for database connection and data checking and form and action
Introduction To Application
Introduction To Application The present application is an online test application, which takes online tests on programming languages. In this application... actions, forwarding request from one action to other etc. In this application
chat application
chat application  I am trying to make a chat application , when user1 send private message to user2 ,a popup should show at user2's screen. i need this code
login application
login application  how to create login application ?   Hi, Please check the following tutorials: Video tutorial - JSP Login Logout... & authenticate it from database mysql Project of a web application
mobile application
mobile application  how can i start my android application project. My project topic is India map puzzle its my mini project within 7 days i should do that so guys plzzzzzz help me in this .... plz share ur idea with me as soon
RegisterForm Application
RegisterForm Application  I am trying run an simple struts application, but it is giving me error: HTTP-status 404 type-status report message-/register description-The requested resource (/register) is not available. plz give me
Architecture of application
components: - Desktop client application (multi-user, multi-role) - Swing... what schould I read, internet links, tutorials would be useful for me. Application... to comunicate between client and middleware running on top of application server, some
Application Variable
Application Variable  I have multiple JSP's that are connected to a Database specifically MSSQL, I connect to the DB using a property file containing the necessary data to establish a connection.. In every page I have to call
application for an Employee
application for an Employee  hi , could any one help for coding in JSP-servlets.. the prob desc is : 1.INPUT:in the 1st page it should accept input for an employeelike (name,empid ,address,dob) and persist in database 2.UPDATE
struts application
struts application  hi, i can write a struts application in this first i can write enter data through form sidthen it will successfully saved into data base **but now i can apply to some validation to that form fileds
Swing Application
Swing Application  hello, i am making swing application in java i am unable to run prog......when my rite clikcing on my project name and clicking thn run it is not showing output .....and when i am cliking on individual java
loyality application
loyality application  Loyalty Application XYZ Bank is a leading... and the senior management wanted to create an attractive Loyalty Application... Mobile recharge coupon Aircel M04 48 The application should provide an option
converter application
converter application  Develop a converter application using event-driven programming paradigm of Java. Procedure: 1. Design a menu bar with two menus. 2. The first menu has the following menu items, Distance, Currency
Mapping Application
Mapping Application The mapping is done within an action file called struts.xml. In the xml file you need to write the name of the action, their corresponding action class and results returned from the Action class. Before mapping
web application
web application  Develop a web application to print back the inputs from the user(name, date of birth, address). The solution should have a JSP file which accepts the userÔ??s name and sent to Servlets which puts the name
 

 

 

DMCA.com