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: ");
}
}
}
}
}
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
Car Rental Application in JavaCar 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 rentalAgra 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
Rental Code GUI - Java BeginnersRental 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
dvd rental system - Java Beginnersdvd
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 officecar 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 officecar 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 officecar 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 projectcar 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 carDelhi to Udaipur by car Hi, I'll drive my
car from Delhi to Udaipur. So, please suggest me the shortest way...
thanks
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 '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
Delhi to Agra Tour by CarDelhi 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 HireAgra
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
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
Same Day Agra Trip by CarSame 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
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"
Swing applicationSwing 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 applicationweb application what is lazy loading in web based
application