Answer:
Following are the code to this question:
import java.text.*;//import package
import java.util.*;//import package
public class ExpenseReportGenerator//defining class ExpenseReportGenerator
{
private static double ONE_USD_TO_NAIRA = 380, PROCESSING_FEE_PERCENTAGE = 3, PENALTY_CHARGE_PERCENTAGE = 5, COST_PER_NIGHT_DOLLAR = 112;//defining double variable as a static type
public static void main(String[] ars) //main method
{
String last_Name,converted_Amount;//defining a String variable
double airline_Fare,HotelStaycost,amountToConvert,total_Expenses,processingFeeCharged,penaltyCharged,amountLeftToConvert;
int no_Nights;//defining integer variable
Scanner sob = new Scanner(System.in);//creating Scanner class object
System.out.println("Enter your last name:");//print message
last_Name = sob.next();//input value
last_Name = last_Name.substring(0, 1).toUpperCase() + last_Name.substring(1, last_Name.length()).toLowerCase(); //holding last_Name value
System.out.println("Enter airline fare:");//print message
airline_Fare = sob.nextDouble();//input value
System.out.println("Enter the number of nights you want to stay at local hotel:");//print message
no_Nights = sob.nextInt();//input value
System.out.println("Enter the the amount you want to convert:");//print message
amountToConvert = sob.nextDouble();//input value
NumberFormat nF = new DecimalFormat("#0.00");//creating NumberFormat class object
sob.close();//close input values
processingFeeCharged = amountToConvert * PROCESSING_FEE_PERCENTAGE / 100;//calculating processingFeeCharged
penaltyCharged = amountToConvert * PENALTY_CHARGE_PERCENTAGE / 100;//calculating penaltyCharged
amountLeftToConvert = amountToConvert - processingFeeCharged - penaltyCharged;//calculating amountLeftToConvert
converted_Amount = nF.format(amountLeftToConvert * ONE_USD_TO_NAIRA);//calculating converted_Amount
HotelStaycost = COST_PER_NIGHT_DOLLAR * no_Nights;//calculating HotelStaycost
System.out.println("\t\t " + last_Name + " Expense Report \t\t");//print values
System.out.println("Airline Fare: $" + airline_Fare);//print values
System.out.println("Total cost for " + no_Nights + " nights: $" + HotelStaycost + " (" + no_Nights + " x $" + COST_PER_NIGHT_DOLLAR + ")");//print values
System.out.println("Amount to be converted: $" + amountToConvert);//print values
System.out.println("Processing fee charged: $" + processingFeeCharged);//print values
System.out.println("Penalty charged: $" + penaltyCharged);//print values
System.out.println("Remaining amount to be converted: $" + amountLeftToConvert + " = " + converted_Amount + " Naira");//print values
total_Expenses = airline_Fare + HotelStaycost + amountLeftToConvert;//calculating total_Expenses
System.out.println("Total expenses (incl. remaining converted amount): $" + total_Expenses + " = " + nF.format(total_Expenses * ONE_USD_TO_NAIRA) + " Naira");//print values
}
}
Output:
Please find the attached file.
Explanation:
In this code, a class "ExpenseReportGenerator" is declared in which the several double variables as the static type is declared that hold the values. Inside the main method, the "double, string, and the integer" variable is declared, which uses the input method to input value from the user-end and pass it into the number list, and uses the print its calculated values.