Untitled
chamanEiqbal
java
3 years ago
3.1 kB
4
Indexable
package assignment2;
import java.util.ArrayList;
import java.util.Scanner;
public class Bill{
public static void main(String[] args) {
String cont;
String partname;
float partQuantity;
float partPrice;
float partDiscount;
String laborName;
float laborPrice;
float laborQuantity;
ArrayList<Parts> parts = new ArrayList<>();
ArrayList<Labor> labor = new ArrayList<>();
Parts p = new Parts();
Labor l = new Labor();
Customer customer = new Customer();
Vehicle vehicle = new Vehicle();
Scanner sc = new Scanner(System.in);
System.out.println("-----Enter Customer detail-----");
System.out.println();
System.out.println();
System.out.print("Enter Customer Name: ");
customer.setName(sc.nextLine());
System.out.println();
System.out.print("Enter Customer contact: ");
customer.setContact(sc.nextLine());
System.out.println();
System.out.println("-----Enter Customer's Vehicle detail-----");
System.out.println();
System.out.println();
System.out.print("Enter Customer's Vehicle Number: ");
vehicle.setVehNumber(sc.nextLine());
System.out.println();
System.out.print("Enter Customer's Vehicle Model: ");
vehicle.setVehModel(sc.nextLine());
System.out.println();
do{
System.out.print("Enter Labor: ");
laborName = sc.nextLine();
System.out.println();
System.out.print("Enter Labor Price: ");
laborPrice = Float.parseFloat(sc.nextLine());
System.out.println();
System.out.print("Enter Labor Quantity: ");
laborQuantity = Float.parseFloat(sc.nextLine());
System.out.println();
labor.add(new Labor(laborName, laborPrice, laborQuantity));
System.out.println();
System.out.println("Do You Want To Continue(yes/no)? ");
cont = sc.nextLine();
}while(cont.equalsIgnoreCase("yes"));
do{
System.out.print("Enter Part Name: ");
partname = sc.nextLine();
System.out.println();
System.out.print("Enter Parts Quantity: ");
partQuantity = Float.parseFloat(sc.nextLine());
System.out.println();
System.out.println("Enter Parts Price: ");
partPrice = Float.parseFloat(sc.nextLine());
System.out.println();
System.out.print("Enter Discount: ");
partDiscount = Float.parseFloat(sc.nextLine());
System.out.println();
parts.add(new Parts(partname, partPrice, partQuantity, partDiscount));
System.out.println("Do You Want To Continue(yes/no)? ");
cont = sc.nextLine();
}while(cont.equalsIgnoreCase("yes"));
for(Labor x:labor){
System.out.println(x.getName());
System.out.println(x.getPrice());
System.out.println(x.getQuantity());
}
sc.close();
}
}Editor is loading...