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]
3 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]3 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
_____ create computer programs by using their knowledge of computer science, math, and other disciplines.
zimovet [89]
B.) Software designers
5 0
3 years ago
The process of making raw materials into a finished product is known as
Olin [163]
1.) Business Engineering or Manufacturing :)
<span />
6 0
2 years ago
Read 2 more answers
Which of the following image file formats uses lossy file compression?
enyata [817]

Answer:

JPEG

Explanation:

5 0
3 years ago
While performing an automatic transmission service at 60,000 miles, the technician notices a grayish sludge on the magnet in the
Evgen [1.6K]

Answer:

Explanation:

One group of students did an experiment to study the movement of ocean water. The steps of the experiment are listed below.

Fill a rectangular baking glass dish with water.

Place a plastic bag with ice in the water near the left edge of the dish.

Place a lighted lamp near the left edge of the dish so that its light falls directly on the plastic bag.

Put a few drops of ink in the water.

The student did not observe any circulation of ink in the water as expected because the experiment had a flaw. Which of these statements best describes the flaw in the experiment? (2 points)

Not enough ink was added.

Not enough water was taken.

The dish was too small for the experiment.

The lamp and the ice bag were at the same place.

6 0
3 years ago
Which game would be classified as an educational game
Masja [62]

Answer:

The various game types can be like board, video and card games. As far as educational video games are concerned they are made to explain to us some of the subjects which can be specific, as well as to teach a certain set of skills like role-playing. They are the interactive play that can help us learn the rules, goals, techniques to solve the problems. adaptation quality, as well as interactions, and all of these are being narrated in the form of a story. You should know that each game is a story in reality, and always. One can think of many such games, and like action games based on the military helps us learn how to fight a war.

Explanation:

Please check the answer.

7 0
3 years ago
Other questions:
  • Information is a valuable asset and not everyone in the world can be trusted with it. Therefore, we need to protect our valuable
    10·1 answer
  • What was the first browser that allowed for graphics to be viewed on the web?
    14·2 answers
  • Tanya has received an email, apparently from her bank, stating that some of her records were lost during server maintenance work
    14·1 answer
  • Which method can help you prevent RSI while using a keyboard?
    14·1 answer
  • When you use information hiding by selecting which properties and methods of a class to make public, you are assured that your d
    14·1 answer
  • Function of dobji dzong​
    14·1 answer
  • Which of the following statements best explains how multitasking works in the human mind?
    11·1 answer
  • sing the drop-down menu, identify the flowchart symbols. The oval represents the . The rectangle represents the . The diamond re
    9·2 answers
  • Explain the following IT terms Network: Packet: Router: IP address: Server: LAN: WAN: Bus topology: Ring topology: Star topology
    5·1 answer
  • What plugs into this?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!