Home Answers Viewqa Java-Beginners Rental Car Application

 
 


vincent mon
Rental Car Application
2 Answer(s)      2 years and a month 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: ");
                                }
                        }
                }
        }
}                                   
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 Pages:
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
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
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
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
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
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
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
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 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 : object oriented
of the car rented, daily rentral fee, length of rental in days, and total rental fee... that contains fields that hold a renterâ??s name, zip code, size of the car rented, daily rentral fee, length of rental in days, and total rental fee. The class
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
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
Application of LBS in Different Fields
, street map, about nearby attractions, transportation service like car rental... Application of LBS in Different Fields   ... application is growing with innovative ideas day by day with the expansion of mobile
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
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
Java Application change to java applet
Java Application change to java applet   Hi every Java Masters i'm...(); System.out.println("1. Two Wheeler"); System.out.println("2. Car...**"); System.out.println("Vehicle type= Car"); if(hr>2){ double amount=(hr-2)*2.30
Mobile Application Development
Mobile Application Development The Mobile Application Development is specified... the application for various mobile devices. Due to low processing and memory power Mobile Application must be well optimized. There are many mobile platforms
Car Website Development
Car Website Development We provide high quality car website development... in developing websites for the Car industry. We are designing, developing, testing, uploading and maintaining websites for car industry. A website
Java Compilation error and how to continue from this - Java Beginners
+makePayment(rent:Rental):void 3.Rental-customer:Customer -car:Car -noOfDays:int... Rental Pte Ltd requires a software system to manage its daily operations like... the application only for renting its vehicles. The completed application should produce
Jaipur Local Transport
influx. The tourist visiting this city can hire the car rental according to their whim and fancy as there are car rentals of different ranges and luxury quotient keep varying. Most of the tourist hires the car rentals for the Jaipur
Java Parking Application
Java Parking Application In this section we are going to calculate the parking... this application, we have used switch case statement through which we have allowed the user... hr $1.50/hr after 3 hr CAR : $1.00/hr first 2 hr $2.30/hr after 2 hr BUS
Car Theft Preventions using Vehicle Tracking System
Car Theft Preventions using Vehicle Tracking System       CAR THEFT: INTRODUCTION As India... equipment and accessories of the car such as batteries, stereos and other
What is Vehicle Tracking Device?
many advantages. Car theft is a major crime. The vehicle tracking system not only prevents car theft, but also helps in tracing and retrieving the stolen cars... is stored in a secured database of Vehicle Tracking application. Sometimes
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
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
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
FlyRig
FlyRig       FlyRig is a New York City apartment rental site with broker reviews, searchable local interest information (such as restaurants, stores, and schools), and public
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
web application
web application  Dear friend, could u plz tell me wats difference bt web server,application server,container with thanks praveen
struts application
struts application  hi, how to retrive data from databse in struts application aand send the retrived data to corresponding form
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
how to convert java Applet to Jave Frame
(){ setLayout(null); lab=new Label("Welcome to Rental Car System...{ JOptionPane.showMessageDialog(null,"Thank survey to Rental Car System...,"Thank survey to Rental Car System and See you Again
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
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.