1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Luba_88 [7]
2 years ago
13

Write a program that produces an expense report for a trip to Lagos, Nigeria. Use the Internet to research the cost to travel to

Lagos. The program requires the traveler's last name and convert the first character of the travels last name to uppercase and the rest to lowercase (this should happen regardless of how the user type the information). Concatenate the last name with the string "Expense Report" to produce the title of the report.
The program should accept the airline fare, the number of nights at a local hotel (do your research), and the dollar amount a user wants to convert to Nigerian Naira. Ensure the currency exchange includes a 3% processing fee and 5% penalty charge when exchanging U.S dollars to Naira.
Note: Make sure your program used:
The decimals do not need to be aligned but they align the = signs for readability.
Constants and variables
Input data
Calculation includes totals
Output display with readable formatting
Use the NumberFormat class to format the monetary values and percentages.
String class
Check out the Payroll.java file that contains most of the syntax to help you get started.
Computers and Technology
1 answer:
Leviafan [203]2 years ago
4 0

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.  

You might be interested in
How can rows be added to a table? Check all that apply
svlad2 [7]
<h2><em>1) By drawing a row in the table using the draw option. </em></h2><h2><em> </em></h2><h2><em>2) By using the insert option under the Table Tools tab. </em></h2><h2><em> </em></h2><h2><em>3) By designing the table with an added row using the Design tab.</em></h2><h2><em></em></h2><h2><em>HOPE IT HELPS (◕‿◕✿)</em></h2>
6 0
2 years ago
Read 2 more answers
Many major employers routinely monitor the performance of their employees through the computers and telephones they use. Employe
STALIN [3.7K]

Answer:

Employers are allowed to check the number of keystrokes that word processors enter during the day.

Explanation:

An employer is authorized to monitor the activity of its employee when:

  • The employee authorizes it.
  • The employer owns the system to be used.
  • Surveillance is necessary for a strictly professional purpose.

By analyzing the keys pressed per day, the employer can determine the performance provided by its employees, and if they use the company's resources, for non-work purposes.

5 0
3 years ago
Often technical personnel who are not familiar with security techniques think that restricting access to ports on a router or fi
zavuch27 [327]

Answer:

This is not a good solution

Explanation:

Your web browser uses port 80 outgoing to make web requests, so if you’re blocking incoming port 80, all you’re blocking is users of the organization from connecting to the internet. You have indeed close a vulnerable port to access from hackers, but this also can reduce the productivity of the organization.

3 0
3 years ago
What is the importance of using the proper markup language?
Klio2033 [76]

the answer is D. without the right tags the content wont be accurately indexed

3 0
3 years ago
Read 2 more answers
The ability to anticipate and determine upcoming driving hazards and conditions are adversely affected by stress.
dybincka [34]
It can be stress or drinking, drugs, or anything of the sort.
6 0
3 years ago
Other questions:
  • The use of digital technology and the Internet to execute the major business processes in the enterprise is called
    11·1 answer
  • The box plot represents this data set. {16, 16, 16, 18, 18, 20, 24, 28, 30, 34} What value does the letter A represent on the bo
    8·2 answers
  • A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
    14·1 answer
  • What is the difference between a key and a superkey?
    10·1 answer
  • Assume that the variables v, w, x, y, and z are stored in memory locations 200, 201, 202, 203, and 204, respectively.
    6·1 answer
  • __________ contain(s) remnants of word processing documents, e-mails, Internet browsing activity, database entries, and almost a
    9·1 answer
  • A web application is an example of:
    7·1 answer
  • Wrtie down some containerization technology.
    11·1 answer
  • How has technology impacted our lives and the world we live in? In your own words.
    9·1 answer
  • Need answer Asap!!!! Which file type is the best choice if the image will be made into a billboard?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!