Question: Good-day please assist me with this Task TASK Compulsory Task 2 Follow these steps: Code a Java program that will meet part of the clients

Good-day

please assist me with this Task

TASK

Compulsory Task 2

Follow these steps:

Code a Java program that will meet part of the clients specifications. You

dont have to meet all the clients specifications at this stage. This

Capstone project will be your first deliverable for Poised. You will build

upon this program in later Capstone projects. For this program, you

should:

o Create a class that will be used to create a project object.

o Create a class that will be used to create person (e.g. architect,

building contractor, etc.) objects.

o Write a program that will allow a user to:

Capture the details that are used to create a new project

object.

Change the due date of the project.

Change the total amount of the fee paid to date.

Update a contractors contact details.

Finalise the project (but dont worry about saving it to a text

file yet).

My code attempt

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

// Create a new project object

System.out.print("Enter project name: ");

String projectName = input.nextLine();

System.out.print("Enter project due date: ");

String dueDate = input.nextLine();

System.out.print("Enter project fee: ");

double fee = input.nextDouble();

Project project = new Project(projectName, dueDate, fee);

// Create a new person object

System.out.print("Enter person's name: ");

String personName = input.nextLine();

System.out.print("Enter person's role: ");

String role = input.nextLine();

System.out.print("Enter person's contact details: ");

String contactDetails = input.nextLine();

Person person = new Person(personName, role, contactDetails);

// Change the due date of the project

System.out.print("Enter new due date for project: ");

String newDueDate = input.nextLine();

project.setDueDate(newDueDate);

// Change the total amount of the fee paid to date

System.out.print("Enter new fee paid to date for project: ");

double newFeePaid = input.nextDouble();

project.setFeePaid(newFeePaid);

// Update a contractor's contact details

System.out.print("Enter new contact details for person: ");

String newContactDetails = input.nextLine();

person.setContactDetails(newContactDetails);

// Finalise the project

project.finalise();

}

}

class Project {

private String name;

private String dueDate;

private double fee;

private double feePaid;

private boolean finalised;

public Project(String name, String dueDate, double fee) {

this.name = name;

this.dueDate = dueDate;

this.fee = fee;

this.feePaid = 0;

this.finalised = false;

}

public void setDueDate(String dueDate) {

this.dueDate = dueDate;

}

public void setFeePaid(double feePaid) {

this.feePaid = feePaid;

}

public void finalise() {

this.finalised = true;

}

}

class Person {

private String name;

private String role;

private String contactDetails;

public Person(String name, String role, String contactDetails) {

this.name = name;

this.role = role;

this.contactDetails = contactDetails;

}

public void setContactDetails(String contactDetails) {

this.contactDetails = contactDetails;

}

}

 

errors from the code

Unfortunately, your program is incomplete. It only functions to take in project details and then abruptly terminates when it is time to "Enter new contact details for person: " Please review the terminating condition for your loop. There are additional editing requirements listed in the task PDF that you have not coded in to your program It is considered bad practice to have multiple Java classes in one file. Many Java tools will not work as expected if you do this. You have left many unused variables in your final program. It is best practice to always remove any unused imports, code and comments to keep your work as clean as possible and easy to follow + maintain.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!