Question

In: Computer Science

Write a Java program for a restaurant with the following features: ◦ Customer: Name, Surname, ID...

Write a Java program for a restaurant with the
following features:
◦ Customer: Name, Surname, ID (incremental ID by 1 for each new customer),
Email, Phone, Address.
◦ Service: ID (incremental ID by1 for each group),CustomerID, Priority (High,
Medium, Low, Other), ResolutionTimeFrame (Measured in Man hours),
AssignedUser, Status(resolved or not), Fee.
◦ User (simple user of system): ID, Name, Surname, Username and Password
(insert from code five fixed users), Address , PhoneNumber
◦ Manager: Name, Surname, Username and Password (insert from code one fixed
manager).
 The program must:
◦ Present a Menu for the simple user after he has logged in with username and
password.
 Menu:
 New Service
 New customer

 Assign a service request to a specific user; Remove Service.
Resolve Service
 Print information for customer with a certain ID
 Apply offers to the different type of customers.(Apply offer to the
Loyal Customer with 10% discount on the fee)
 Overall number of Services requested by customers assigned to a
user with a certain username. (requires manager password)
◦ Total amount of all fees of resolved Services processed by
the user with a certain username (requires manager
password).
◦ Total amount of all fees of resolved Services on the current
day (requires manager password).

 Change user from one to another (Each user should manage its
own portfolio of customers)
◦ Change from User to Manager
◦ Change from Manager to User
 Exit

After implementation of the first phase start to include the following specifications: For the
classes Customer and Services make sure you use a static integer field for the incremental ID of
the objects of these classes.
 Introduce inheritance in the project design with the following:
a. Add a new class
Person class: with the following attributes;
 Name Surname
 ID
 Username
 Password
 Address
 PhoneNumber
Classes inheriting from Person:
i. Manager: has two additional features more than the Person called InternalPhoneNumber and
PIN to start the software at the beginning of the day.
ii. User: has these fields more than Person: InternalPhoneNumber, baseSalary.

b) Classes inheriting from Customer class
The following types of Customer exists.
i. SimpleCustomer
ii. Class LoyalCustomer which has additional features: IndividualID and Discount.
The manager inserts the discount amount periodically. (It may be also 0 )
iii. Class BusinessCustomer, which has additional features more than Customer,
called Business ID(NIPT) and has an additional feature more than
LoyalCustomer called BusinessDiscount. The manager will define the amount of
BusinessDiscount. The overall discount is calculated as Discount +
BusinessDiscount.

Define the following methods in all classes:
calculateTotalFee( ) : Calculate the Total fee with the discount for each of these classes
PrintInfo( ): Print all the information of the Service

Complete the following extensions to the current project:
1. Start the program with a login window where you request username and password for the
user.
2. Once the user is logged in show the following window with this menu:
 File
 Help (show a simple window with few instructions on how to use the program)
 Exit (close the program)
Suggestion: Use JDesktopPane within JFrame
Put in the File menu the following voices:
 New Customer (suggestion: open a new JInternalFrame for a new customer)
 Overall number of customers for some user (show a pop-up with the number of
customers served or on hold)
 Total amount of all Customer services for the User (show a pop-up with the
amount of Services served )
Within the internal frame implement the following:
 New Service for a specific customer
o Choose Service type
o Choose Service to be added.
o Print Customer services info
o Remove A service

Suggestion: use JMenu for first level (New Service), JMenu for second level (Example: Choose
Service Type)

Solutions

Expert Solution

public class Customer

{

   public String Name;
   public String Surname;
   int ID;
   public Customer(String Name,String Surname)
   {
   this.Name=Name;
   this.Surname=Surname;
   }
}

CustomerProcessing.java

import java.util.*;
public class CustomerProcessing {
  
   private static List<Customer> Customers=new ArrayList<Customer>();
   //New customer
   public void AddCustomer(Customer objCustomer)
   {
       objCustomer.ID=Customers.size()+1;
       Customers.add(objCustomer);      
   }
   //Print information for customer with a certain ID
   public Customer GetCustomerInfo(int CustomerId)
   {
       Customer objCustomer=Customers.get(CustomerId-1);
       return objCustomer;
   }
  
}

Manager.java


public class Manager {
  
   String Name;
   String Surname;
   String Password;
   public Manager(String Name,String Surname,String Password)
   {
       this.Name=Name;
       this.Surname=Surname;
       this.Password=Password;
   }
}

ManagerProcessing.java

import java.util.ArrayList;
import java.util.List;

public class ManagerProcessing {
private static List<Manager> Managers=new ArrayList<Manager>();
  
   public void AddManager(Manager objManager)
   {      
       Managers.add(objManager);      
   }
}

Service.java


public class Service {

   int Id;
   int CustomerId;
   String Priority;
   int ResolutionTimeFrame;
   int AssignedUser;
   String Status;
   float Fee;
  
   Service(int CustomerId,String Priority,int ResolutionTimeFrame,float Fee,int AssignedUser)
   {
       this.CustomerId=CustomerId;
       this.Priority=Priority;
       this.ResolutionTimeFrame=ResolutionTimeFrame;
       this.Fee=Fee;
       this.AssignedUser=AssignedUser;
       this.Status="No";
   }
}

ServiceProcessing.java

import java.util.ArrayList;
import java.util.List;


public class ServiceProcessing {

   private static List<Service> Services=new ArrayList<Service>();
   public void AddnServiceRequest(Service objService)
   {
       Services.add(objService);
   }
   public void AssignServiceToUser(int ServiceId,int UserId)
   {
       Service objCustomer=Services.get(ServiceId-1);
       objCustomer.AssignedUser=UserId;
   }
   public void RemoveService(int ServiceId)
   {
       if(Services.size()<=ServiceId)
       {
           Services.remove(ServiceId-1);
       }
   }
   //Changes service state to Solved
   public void ResolveService(int ServiceId)
   {
       Service objService=Services.get(ServiceId-1);
       objService.Status="Solved";
   }
   private static List<Service> getServicesByUserId(int UserId) {
       List<Service> result = new ArrayList<Service>();
for (Service serviceObj : Services) {
if (serviceObj.AssignedUser==UserId) { // we dont like mkyong
result.add(serviceObj);
}
}
return result;
}
   // Overall number of Services requested by customers assigned to a
   //user with a certain username.
   public List<Service> NumberOfServicesRequestedByUser(String Username)
   {
       UserProcessing objUP=new UserProcessing();
       int UserId=objUP.GetUserIdByUserName(Username);
       return getServicesByUserId(UserId);      
   }
}


Related Solutions

Write a Java program which asks customer name, id, address and other personal information, there are...
Write a Java program which asks customer name, id, address and other personal information, there are two types of customers, walk-in and credit card. The rates of items are different for both type of customers. System also asks for customer type. Depending upon customer type, it calculates total payment. A credit-card customer will pay 5 % extra the actual price. Use object-oriented concepts to solve the problem. Define as many items and prices as you want. Example Output: Enter Name...
Create a program that allows a user to input customer records (ID number, first name, last...
Create a program that allows a user to input customer records (ID number, first name, last name, and balance owed) and save each record to a file. When you run the main program, be sure to enter multiple records. Once you create the file, open it and display the results to the user Save the file as  CustomerList.java
List customer id, customer full name (Last name, full name, state) for those customers that have...
List customer id, customer full name (Last name, full name, state) for those customers that have ordered more than once. List customers (order id, customer id, and customer last name) that had more than 2 -- products in their order. Order your result based on customer id followed by order id SQL SERVER DATABASE
Code in Java Write a Student class which has two instance variables, ID and name. This...
Code in Java Write a Student class which has two instance variables, ID and name. This class should have a two-parameter constructor that will set the value of ID and name variables. Write setters and getters for both instance variables. The setter for ID should check if the length of ID lies between 6 to 8 and setter for name should check that the length of name should lie between 0 to 20. If the value could not be set,...
write a program i java that ask the user to enter salary, user ID and username...
write a program i java that ask the user to enter salary, user ID and username and out put them
Write a complete Java program to print out the name bob
Write a complete Java program to print out the name bob
Description Write a program that prints out your name, the course ID of this class, what...
Description Write a program that prints out your name, the course ID of this class, what programming/computer courses you've taken. Ask the user for two numbers. Show the sum of the two numbers, the difference, the product and the quotient. For the difference subtract the second number from the first, for the quotient, use the first number as the numerator(dividend) and the second as the denominator(divisor). Sample Output: My name is Jianan Liu, I'm in course CS36. I've taken: C...
Write the following java program: Desc Output the name and time of the runner who came...
Write the following java program: Desc Output the name and time of the runner who came in first, as well as the name and time of the runner who came in last in a marathon race (assuming there are no ties). Input A text file named marathon.txt containing the name and time of each participant in the following format (the file has at least 1 participant, name is just 1 word with no space, and name and time are separated...
Write a Java program thatdoes the following jobs.Step1. Creates a Schooltable with name, score, rating, and...
Write a Java program thatdoes the following jobs.Step1. Creates a Schooltable with name, score, rating, and district.Step2. Reads data from theCSVfile(elementrayschool.csv)and insert the schoolsinto the table created in Step 1.Step3. Interact with the user, wheretheusercan select one of the following actions.-(Q) Quit: quit the program-(A) Add a school-(C) Calculate average rating-(S) Print a subset of the schools based on score-(D) Print a subset of the schools based on districtThe user can choose one of these actions bytyping Q,A,C, S, or...
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone...
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone Email 9087 John Doe 204 University Ave. 987-098-9087 [email protected] 2098 Bill Lawrence 123 Jones St 717-387-3387 Business 2398 Laura Smith 0900 West Blvd. 901-234-4567 Information Transactions Customer ID Account Number Date of Last Transaction 9087 375 01/31/98 2098 123 03/09/97 2398 375 09/21/97 2098 375 12/31/97 2398 123 02/01/98 Accounts Account Number Balance Account Type 375 234.45 Checking 123 056.90 Savings 1. Who owns...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT