Get the answers you need at Westonci.ca, where our expert community is dedicated to providing you with accurate information. Join our platform to connect with experts ready to provide detailed answers to your questions in various areas. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.
Sagot :
Answer:
Explanation:
The following program was written in Java. It creates the function as requested and asks the user for all the values as inputs. No proper reason was given for asking for low income so I just added it as a yes or no print statement. The picture below shows the inputs and outputs of the program.
import java.util.ArrayList;
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Hourly rate: ");
double rate = in.nextDouble();
System.out.println("Consulting Time in minutes: ");
int consultingTime = in.nextInt();
System.out.println("Low Income? y/n");
String lowIncome = in.next().toLowerCase();
String lowIncomeAnswer;
if (lowIncome.charAt(0) == 'y') {
lowIncomeAnswer = "Yes";
} else {
lowIncomeAnswer = "No";
}
System.out.println("Billing Amount: " + billing(rate, consultingTime, lowIncome));
System.out.println("Low Income: " + lowIncomeAnswer);
}
public static double billing(double rate, int consultingTime, String lowIncome) {
double timeHours = consultingTime / 60;
double billing = rate * timeHours;
return billing;
}
}
Thanks for using our service. We're always here to provide accurate and up-to-date answers to all your queries. We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. Thank you for choosing Westonci.ca as your information source. We look forward to your next visit.