What is wrong with this image. It shows the error

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

What is wrong with this image. It shows the error.

 

Chrome
← → C
File Edit View History
fresh
fresh
FAST AND FREE
SHIPPING
Online Java - IDE, Code Editor, X
online-java.com
$74
Soy Hydrating
Gentle Face
Cleanser 13.5 oz /
SHOP NOW
SEPHORA
Bookmarks Profiles Tab Window
Bard
</> ONLINE JAVA BETA
6
7
8
9
10
11
12
8
13
14
15
16
17
18
Main.java buyitem.java +
1- import java.util.Scanner;
2- public class BuyItem {
3
4
19
20
21
22
23
24
25
26
27
28
29
30
31
32}
<
▶ Run
}
Ln: 2, Col: 1
Help
b My Questions | bartleby
public static void main (String args[]) {
String desc=""; // Variable to store the item's description
double price; // Variable to store the price of item
int qty; // Variable to store the no. of item
double total; // Variable to store total amount of purchase
double tax; // Variable to store tax on purchase
double final_amt; // total+tax
Scanner sc = new Scanner(System.in);
System.out.println("Welcome to our store.");
System.out.print("Please enter the item's description: ");
desc= sc. nextLine(); // Taking input
System.out.print("Please enter the item's price: ");
price = sc.nextDouble(); // Taking input
1 error
System.out.print("Please enter the quantity: ");
qty = sc.nextInt(); // Taking input
total = price*qty; // Calculating the total amount of purchase
tax = 0.095*total; // Calculating tax on purchase
final_amt = total+tax; // Calculating final amount
System.out.println("--
// Displaying out
System.out.println("Invoice");
G Google Account
Share Command Line Arguments
System.out.println("Item's description: "+desc);
System.out.println("Unit price: $"+price);
"+qty);
$"+total);
System.out.println("Quantity:
System.out.println("total:
System.out.println("tax (9.5%): $"+tax);
System.out.println("\nInvoice Amount: $"+String.format("%.2f", final_amt));
** Process exited - Return Code: 1 **
");
Main.java:2: error: class BuyItem is public, should be declared in a file named BuyItem.java
public class BuyItem {
SEP
12
+
W
With us, it isn't just possible.
It's happening.
P
Pr
ld
LEARN HOW
Ps
COMCAST
BUSINESS
Au Ai Ae Me Σ
43
zoom
Aa
☀
java
H
G✩
Tue Sep 12 5:23 PM
O
MOS
SECRET
INVASION
Disney+
ORIGINAL SERIES
Now streaming
Sign Up Now
© 2023 MARVEL.
Must be 18+ to subscribe.
Feedback
(X)
Transcribed Image Text:Chrome ← → C File Edit View History fresh fresh FAST AND FREE SHIPPING Online Java - IDE, Code Editor, X online-java.com $74 Soy Hydrating Gentle Face Cleanser 13.5 oz / SHOP NOW SEPHORA Bookmarks Profiles Tab Window Bard </> ONLINE JAVA BETA 6 7 8 9 10 11 12 8 13 14 15 16 17 18 Main.java buyitem.java + 1- import java.util.Scanner; 2- public class BuyItem { 3 4 19 20 21 22 23 24 25 26 27 28 29 30 31 32} < ▶ Run } Ln: 2, Col: 1 Help b My Questions | bartleby public static void main (String args[]) { String desc=""; // Variable to store the item's description double price; // Variable to store the price of item int qty; // Variable to store the no. of item double total; // Variable to store total amount of purchase double tax; // Variable to store tax on purchase double final_amt; // total+tax Scanner sc = new Scanner(System.in); System.out.println("Welcome to our store."); System.out.print("Please enter the item's description: "); desc= sc. nextLine(); // Taking input System.out.print("Please enter the item's price: "); price = sc.nextDouble(); // Taking input 1 error System.out.print("Please enter the quantity: "); qty = sc.nextInt(); // Taking input total = price*qty; // Calculating the total amount of purchase tax = 0.095*total; // Calculating tax on purchase final_amt = total+tax; // Calculating final amount System.out.println("-- // Displaying out System.out.println("Invoice"); G Google Account Share Command Line Arguments System.out.println("Item's description: "+desc); System.out.println("Unit price: $"+price); "+qty); $"+total); System.out.println("Quantity: System.out.println("total: System.out.println("tax (9.5%): $"+tax); System.out.println("\nInvoice Amount: $"+String.format("%.2f", final_amt)); ** Process exited - Return Code: 1 ** "); Main.java:2: error: class BuyItem is public, should be declared in a file named BuyItem.java public class BuyItem { SEP 12 + W With us, it isn't just possible. It's happening. P Pr ld LEARN HOW Ps COMCAST BUSINESS Au Ai Ae Me Σ 43 zoom Aa ☀ java H G✩ Tue Sep 12 5:23 PM O MOS SECRET INVASION Disney+ ORIGINAL SERIES Now streaming Sign Up Now © 2023 MARVEL. Must be 18+ to subscribe. Feedback (X)
Expert Solution
Step 1: Introduction

In Java, the name of the file must match the name of the public class it contains. If the class is called MyClass, the file should be named MyClass.java. It should also be saved in a directory structure that matches the package name.

For example, if the package is called com.example, then the directory structure should also be com > example. This is the convention for Java, and it helps prevent naming conflicts for classes.

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Concept of Light
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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