project.java - import java.io import java.util. import java.util.Scanner public class project private static Scanner in = new Scanner(System.in public

project.java - import java.io import java.util. import...

This preview shows page 1 - 2 out of 5 pages.

import java.io.*; import java.util.InputMismatchException; import java.util.Scanner; public class project { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { replace(); launch1(menu1()); } private static char menu1() { System.out.println(" Select "); System.out.println("For User press: 0"); System.out.println("For Admin press: 1"); System.out.print("Your Choice: "); return in.next().charAt(0); } private static char menu() { System.out.println(); System.out.println(" Menu "); System.out.println("To Add Items press: 0"); System.out.println("To Edit Items press: 1"); System.out.println("To Delete items press: 2"); System.out.println("To Show items press: 3 "); System.out.println("If you want to place an order press: 4"); System.out.println("If you want to terminate the program press 5"); System.out.print("Enter your choice: "); return in.next().charAt(0); } private static boolean login() { boolean isFound = false; byte tries = 3; for (int a = 0; a < 3; a++) { String u = "admin"; String p = "123"; System.out.print("Enter username: "); String user = in.next(); in.nextLine(); System.out.print("Enter password: "); String pass = in.nextLine(); if (user.equals(u) && (pass.equals(p))) { System.out.println(); System.out.println("!!..Welcome to Store..!!"); isFound = true; break; } else { // user have only three tries to login the program System.out.println("Invalid Username or Password!"); tries *= 1; System.out.println("Number of tries remaining: " + (tries));
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read all 5 pages?

  • Spring '17
  • Ijlal

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture