Provide a method getTotalCost() that calculates the total cost of the project by summing
the budget and the salary of each member of the project. The salary of each m ember
can be found by calculating an appropriate method of the Worker class
import java.util.Scanner;
public class Main
{
static void getTotalCost(){
Scanner input=new Scanner(System.in);
System.out.println("Enter the number of employees: ");
int n=input.nextInt();
System.out.println("Enter the price of each employee: ");
int price=input.nextInt();
System.out.println("Total cost of project "+price*n);
}
public static void main(String[] args) {
getTotalCost();
}
}
Comments
Leave a comment