Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

reate an EClipse project, then mport the CPS150-PAS, Java source code Tlle. Do n

ID: 3588234 • Letter: R

Question

reate an EClipse project, then mport the CPS150-PAS, Java source code Tlle. Do nor create a Main Class: Instead. 1. Download the file into the src sub-folder of your project folder. Remember that if you created the project in the default location, the project folder is located in the workspace folder of your home folder (e.g.: C Usersldoej1workspace) 2. In Eclipse's Project explorer: i. Expand your project folder to display the src sub-folder. ii. Right-click on the src sub-folder, and select the Refresh option. ii. Expand the src sub-folder, and then the default package sub-folder. iv. Open the file CPS150_PA5,java. Then, complete the program by adding the required method definitions: . readstring(String) -> String Displays the received String as a user prompt, returns the String input by the user. . readDouble (String) -> double Displays the received String as a user prompt, returns the double input by the user. calcSalary (double, double) -> double Calculates and returns the projected salary, with the received current salary and the received percentage raise. displayResults (String, double, double, double) Displays the received name, current salary, percentage raise, and projected salary.

Explanation / Answer

CalculateSalary.java

import java.util.Scanner;

public class CalculateSalary {

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

static Scanner sc = new Scanner(System.in);

public static void main(String[] args) {

//Declaring variables

double percentageRise = 5.0;

//Getting the input entered by the user

String name = "Enter name :";

String salary = "Please Enter your salary :";

//Calling the methods

name = readString(name);

double csal = readDouble(salary);

double projectedSal = calcSalary(csal, percentageRise);

displayResults(name, csal, percentageRise, projectedSal);

}

//This method will display the output

private static void displayResults(String name, double csal,

double percentageRise, double projectedSal) {

System.out.println(""" + name + "" your salary is $" + csal + ". If you get a " + percentageRise + "% raise ,your new salary will be $" + projectedSal);

}

//This method will calculate the projected salary after percentage rise

private static double calcSalary(double csal, double percentageRise) {

return csal + (csal * (percentageRise / 100));

}

//This method will read the current salary

private static double readDouble(String salary) {

System.out.print(salary);

double sal = sc.nextDouble();

return sal;

}

//This method will read the name

private static String readString(String name) {

System.out.print(name);

name = sc.next();

return name;

}

}

________________

Output:

Enter name :Mary
Please Enter your salary :25500
"Mary" your salary is $25500.0. If you get a 5.0% raise ,your new salary will be $26775.0

_____________Could you rate me well.Plz .Thank You