Can someone help me fix my code? I need to make a cashiering system with a receipt. I also wanted to include the time and date in the receipt

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Can someone help me fix my code? I need to make a cashiering system with a receipt. I also wanted to include the time and date in the receipt

 

import java.util.Scanner;

class List{

private String name;
private int item;
private String[] des;
private int[] price;
private int[] quan;
private int total;

public List (String name, int item, String[] des, int total, int[] price) {
this.name = name;
this.item = item;
this.des = des;
this.price = price;
this.total = total;
}
public void Input() {
Scanner sc=new Scanner(System.in);
System.out.print("Enter name of customer:");
name=sc.next();
System.out.print("Enter the Number of items:");
item=sc.nextInt();
String []des=new String[item];
int []price=new int[item];
int []quan = new int [item];
total=0;

for (int i=0; i<item; i++) {
System.out.print("Enter item name:");
des[i]=sc.next();
System.out.print("Enter price:");
price[i]=sc.nextInt();
System.out.print("Enter quantity:");
quan [i]=sc.nextInt();

sc.close();
}
}
public void Menu() {
System.out.print("Item list:\n");
System.out.println("Scisscors\n"
+ "Ruler\n"
+ "Crayons\n"
+ "Glue\n"
+ "Eraser\n"
+ "Notebook\n"
+ "Paper\n"
+ "Highlighter\n"
+ "Folder\n"
+ "Pen\n"
+ "Pencil\n");
}
public int Total(int x) {

return x;

}

public void Receipt() {
System.out.println("From");
System.out.println("XYZ MARket Place");
System.out.println("Customer Name: "+ this.name);
System.out.println();
System.out.print("S.No ");
System.out.print("Item name ");
System.out.print("Price ");
System.out.println();
for(int i=0;i<item;i++){
System.out.print(" "+i+ " ");
System.out.print(des[i]+" ");
System.out.print(price[i]);
System.out.println();
}
System.out.println(" Subtotal: "+this.total);
System.out.println(" VAT: 12%");
float vat=(float)0.12*this.total;
float gtotal=(float)this.total+vat;
System.out.println(" total:"+gtotal);
}

}


public class Pajanconi {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int reply, total = 0, price[], quan[] = null;
String name= "";
List obj = new List(name, total, args, total, quan);
obj.Menu();

do {
obj.Input();
obj.Receipt();
System.out.println("Perform another transaction? yes (1) / no (2)");
reply = sc.nextInt();

}while (reply == 1 );
sc.close();
}

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education