Question
Good-day Please assist with correct code as per below reviewer comment. Corrections 2B made There are a few suggestions that I would like to make
Good-day
Please assist with correct code as per below reviewer comment.
Corrections 2B made
There are a few suggestions that I would like to make for you to meet the task's requirements. I would suggest making use of a menu that gives the user the following options and any others you think may be useful, instead of just asking the user to start adding the architect's details. This can help to make it to improve the experience for the user while also meeting all of the tasks requirements. 1. Reads details about existing projects from a text file and uses this information to create a list of project objects. - You want to ensure the program still works even if the user does not select this option. 2. Allows a user to add new objects to this list. 3. Allows a user to select and update or finalize any project on the list. 4. Allows a user to see a list of projects that still need to be completed. 5. Allows a user to see a list of projects that are past the due date. 6. Writes the updated details about the projects to the text file when the program ends. *I would recommend making a different menu option for each of those requirements, and making use of methods to organize your program and improve its readability.
As part of the tasks requirements doc comments should be used to generate documentation with the Javadoc tool, below I share a helpful link on this.
Lastly, another part of the requirements is to make use of exception handling within your program, for example what happens if the user enters a string for telephone number instead of a number.
MY Java file CODES.
ProjectOverview.java
import java.util.Scanner; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class ProjectOverview { public static void main(String [] args) throws ParseException { //architecture details System.out.println("These column inputs the details of the architecture "); System.out.println("Enter the name of the architecture:"); Scanner arch_name = new Scanner(System.in); String name = arch_name.nextLine(); System.out.println("Enter the telephone numbers of the architecture: "); Scanner scandet = new Scanner(System.in); int telephone_numbers = scandet.nextInt(); System.out.println("Enter the physical address of the architecture"); Scanner new_address = new Scanner(System.in); String physical_address = new_address.nextLine(); System.out.println("Enter the email address of the architecture"); Scanner new_email = new Scanner(System.in); String email_address = new_email.nextLine(); System.out.println();// create a double line between inputs and results System.out.println(); Architect ArchObject = new Architect(name, telephone_numbers, physical_address, email_address); System.out.println("Details of the architecture: "); System.out.println(ArchObject); //lines between architecture& customer details System.out.println(); System.out.println(); //customer details System.out.println("These column inputs the details of the customer"); System.out.println("Enter the name of the customer:"); Scanner customer = new Scanner(System.in); String customer_name = customer.nextLine(); System.out.println("Enter the telephone numbers of the customer: "); Scanner tel_num = new Scanner(System.in); int customer_tel = tel_num.nextInt(); System.out.println("Enter the physical address of the customer"); Scanner customer_address = new Scanner(System.in); String address = customer_address.nextLine(); System.out.println("Enter the email address of the customer"); Scanner customer_email = new Scanner(System.in); String email_for_customer = customer_email.nextLine(); System.out.println();// create a double line between inputs and results System.out.println(); Customer custObj = new Customer(customer_name, customer_tel, address, email_for_customer); System.out.println("Details of the customer: "); System.out.println(custObj); //lines between project& customer details System.out.println(); System.out.println(); //project Detials System.out.println("These column inputs the details of the project"); System.out.println("Enter project number: "); Scanner proj_num = new Scanner(System.in); int project_number = proj_num.nextInt(); System.out.println("Enter ERF number: "); Scanner ERF_num = new Scanner(System.in); String ERF_number = ERF_num.nextLine(); System.out.println("Enter customer name: "); Scanner proj_cust_name = new Scanner(System.in); String project_customer_name = proj_cust_name.nextLine(); System.out.println("Enter customer surname: "); Scanner proj_cust_surname = new Scanner(System.in); String project_customer_surname = proj_cust_surname.nextLine(); String project_customer = project_customer_surname + " " + project_customer_name; System.out.println("Enter project name: "); Scanner proj_name = new Scanner(System.in); String project_name = proj_name.nextLine(); System.out.println("Enter project type: "); Scanner proj_type = new Scanner(System.in); String project_type = proj_type.nextLine(); if(project_name == " ") { project_name = project_type + project_customer_surname; } System.out.println("Enter current date (yyyy-MM-dd):"); Scanner current_date = new Scanner(System.in); String date1 = current_date.nextLine(); System.out.println("Enter deadline for the project (yyyy-MM-dd): "); Scanner deadline = new Scanner(System.in); String date2 = deadline.nextLine(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date first_date = sdf.parse(date1); Date second_date = sdf.parse(date2); System.out.println();// create a double line between inputs and results System.out.println(); Project projObj = new Project(project_number, ERF_number, project_customer, project_name, project_type, date2); System.out.println("Details of the project: "); System.out.println(projObj); if (first_date.after(second_date)) { System.out.println("Project is overdue"); } //lines between project and invoice details System.out.println(); System.out.println(); //Invoice details System.out.println("These column inputs the details of the invoice"); System.out.println("Enter the name of the customer :"); Scanner cust_inv_name = new Scanner(System.in); String invoice_customer = cust_inv_name.nextLine(); System.out.println("Enter the telephone numbers of the customer: "); Scanner cust_inv_tel = new Scanner(System.in); String invoice_telephone_numbers = cust_inv_tel.nextLine(); System.out.println("Enter the total fee to be paid:"); Scanner total_fee_cust = new Scanner(System.in); double total_fee = total_fee_cust.nextDouble(); System.out.println("Enter the total fee paid:"); Scanner total_paid_cust = new Scanner(System.in); double total_paid = total_paid_cust.nextDouble(); double balance = total_fee - total_paid; if (balance == 0) { System.out.println("Your balance is 0 so there is no invoice "); } System.out.println();// create a double line between inputs and results System.out.println(); System.out.println("INVOICE "); Invoice objInv = new Invoice(invoice_customer, invoice_telephone_numbers, total_fee, total_paid, balance); System.out.println(objInv); } }
Project.java file
public class Project { int project_number; String project_name; String project_type; String ERF_number; String customer_name; String customer_surname; String customer; String deadline; public Project(int project_number, String ERF_number, String customer, String project_name, String project_type, String deadline) { this.project_number = project_number; this.project_name = project_name; this.project_type = project_type; this.ERF_number = ERF_number; this.customer = customer; this.deadline = deadline; } public String getCustomer() { return customer; } public String getERFNumber() { return ERF_number; } public String getProjectType() { return project_type; } public String getProjectName() { return project_name; } public String getDeadline() { return deadline; } public String toString() { String output = "Project number: " + project_number + " "; output += "ERF number: " + ERF_number + " "; output += "Customer name: " + customer + " "; output += "Project name: " + project_name + " "; output += "Project type: " + project_type + " "; output += "Project deadline: " + deadline; return output; } }
Achitect.java file
public class Architect { String name; int telephone_number; String email_address; String physical_address; public Architect(String name, int telephone_number, String email_address, String physical_address) { this.name = name; this.telephone_number = telephone_number; this.email_address = email_address; this.physical_address = physical_address; } public String getName() { return name; } public String getEmailAddress() { return email_address; } public String getPhysiclAddress()// constructor that will return the argument physical address { return physical_address; } public int getTelephone() { return telephone_number; } public String toString() { String output = "Name: " + name + " "; output += "Telephone number: " + telephone_number + " "; output += "Email address: " + email_address + " "; output += "Physical address: " + physical_address + " "; return output; } }
Customer.java file
public class Customer { String name; int telephone_number; String email_address; String physical_address; public Customer(String name, int telephone_number, String email_address, String physical_address) { this.name = name; this.telephone_number = telephone_number; this.email_address = email_address; this.physical_address = physical_address; } public String getName() { return name; } public String getEmailAddress() { return email_address; } public String getPhysiclAddress() { return physical_address; } public String toString() { String output = "Name: " + name + " "; output += "Telephone number: " + telephone_number + " "; output += "Email address: " + email_address + " "; output += "Physical address: " + physical_address + " "; return output; } }
invoice.java file
public class Invoice { String customer_name; String customer_surname; String customer; double total_fee; double total_paid; double balance; String contact_details; public Invoice(String customer, String contact_details, double total_fee, double total_paid, double balance) { this.customer = customer; this.total_fee = total_fee; this.total_paid = total_paid; this.balance = balance; this.contact_details = contact_details; } public String getCustomer() { return customer; } public String getContanctdetails() { return contact_details; } public double getTotalFee() { return total_fee; } public double getTotalPaid() { return total_paid; } public double getBalance() { return balance; } public String toString() { String output = "Customer name: " + customer + " "; output += "Contact details: " + contact_details + " "; output += "Opening balance:" + total_fee + " "; output += "Paid amount: " + total_paid + " "; output += "closing balance: " + balance; return output; } }
TASK Follow these steps: Design your program to meet the specifications given by the client. Extend the program that you have written in previous Capstone Projects so that this program also: o Reads details about existing projects from a text file and uses this information to create a list of project objects. o Allows a user to add new objects to this list. o Allows a user to select and update or finalise any project on the list. o Allows a user to see a list of projects that still need to be completed. o Allows a user to see a list of projects that are past the due date. o Writes the updated details about the projects to the text file when the program ends. Besides meeting the above criteria, you should also do the following: o Make sure that your program includes exception handling. Use try-catch blocks wherever appropriate. This should include ensuring that your program handles exceptions related to writing or reading to/from text files and exceptions related to acquiring user input. o Make sure that you have completely removed all errors from your code. Take extra care to ensure that logical and runtime errors have been detected and removed. o Make sure that your code has been adequately refactored. o Make sure that your code is adequately documented. Adhere to the style guide found here. o Use Javadoc to generate API documentation from documentation comments for your program. Submit your fully debugged and refactored code and the documentation for your project to a code reviewer. After receiving feedback from a code reviewer and improving your code based on this feedback, add your program to Github.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started