Once the entire submission has been completed, the user must be informed that the product details have been successfully saved.
public class Product {
private String name;
private double price;
private String manufacturer;
public Product(String name, double price, String manufacturer) {
this.name = name;
this.price = price;
this.manufacturer = manufacturer;
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter the name of the product: ");
String name = in.nextLine();
System.out.print("Enter the price of the product: ");
double price = Double.parseDouble(in.nextLine());
System.out.print("Enter the manufacturer of the product: ");
String manufacturer = in.nextLine();
Product product = new Product(name, price, manufacturer);
System.out.println("The product details have been successfully saved");
}
}
Comments
Leave a comment