Answer to Question #239074 in Java | JSP | JSF for Princess

Question #239074
Q.1.12

Finally, provide the ability for the user to exit the application.

Additional Requirements:

In your solution, you must create a class called Products, which will contain all your working methods

This class will, as a minimum, contain the following methods, but you are encouraged to add more methods

SearchProduct().

SaveProduct(),

UpdateProduct();

DeleteProduct().

DisplayMenu(),

Capture Product().

ExitApplication();

3. Finally, create a main class to run your application.
1
Expert's answer
2021-09-20T16:44:09-0400
import java.util.Scanner;
//class Product
public class Main {
 public void SearchProduct() {
    System.out.println("The product found!");
  }
 public void SaveProduct() {
    System.out.println("The product successfully saved!");
  }
 public void UpdateProduct() {
    System.out.println("The value of the product successfully updated!");
  }
 public void DeleteProduct() {
    System.out.println("The product deleted!");
  }
 public void DisplayMenu() {
    System.out.println("This is the menu!");
  }
 public void CaptureProduct(){
    System.out.println("The product has been captured!");
  }
 public void ExitApplication() {
  }
  public void speed(int maxSpeed) {
    System.out.println("Max speed is: " + maxSpeed);
  }
  public static void main(String[] args) {
      int option;
    System.out.print("Choose the operation to perform:\n1.SearchProduct\n2.UpdateProduct\n3.DeleteProduct\n4.DisplayMenu\n5.Capture the product\n6.Exit the application ");
     Scanner input=new Scanner (System.in);
    option=input.nextInt();
    Main myProduct = new Main();
    if(option==1){
    myProduct.SearchProduct(); }
    else if(option==2){
    myProduct.UpdateProduct();}
    else if(option==3){
    myProduct.DeleteProduct();}
    else if(option==4){
    myProduct.DisplayMenu();}
    else if(option==5){
    myProduct.CaptureProduct();}
    else if(option==6){
    myProduct.ExitApplication();}
      else{
          System.out.print("Invalid option!");}
      }
  }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS