Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Needs to be in basic pseudocode. 4) Plan the logic for an airport services compa

ID: 3869157 • Letter: N

Question

Needs to be in basic pseudocode.

4) Plan the logic for an airport services company program to determine service fees. The program prompts the user for their name and the type of service needed—parking or shuttle. Depending on the service type, the main program gets additional information from the user and then calls one of the methods described below, to determine their fee, and then displays the user’s name, the service type and the fee. The methods are:

a) calculateParkingFee method

i) requires to be passed information (“Y” or “N”) that indicates whether the user is a member of the company’s frequent parker program, and the number of days of parking required

ii) if the user is a member, they receive a 10% discount on the regular parking fee of $12 per day

iii) the method returns the total parking fee

b) calculateShuttleFee method

i) requires to be passed the number of passengers and the total number of bags being brought by the passengers

ii) determines the shuttle fee as follows:

(1) a base fee of $29 per passenger

(2) the base fee includes one free bag per passenger; any additional bags are charged a fee of $2 each

iii) the method returns the total shuttle fee

Example of what I'm looking for is;

start

Declarations

num itemPrice

num salespersonCommission

num customerDiscount

output “Welcome to the sales price calculator.”

output “This program will help you calculate the final”,

"price of a product adding in all factors.”

finalPrice= calculatePrice()

output “The total price after Commission, $” salespersonCommission, “and customer discount,”

“ customerDiscount “%, is”, finalPrice

stop

Explanation / Answer

import javax.swing.JOptionPane;
import java.text.DecimalFormat;
public class Calculator
{
public static void main(String[] args)
{
double initialPrice = 0.00;
double commissionRate = 0;
double discountRate = 0;
initialPrice = Double.parseDouble(JOptionPane.showInputDialog(null, "What is the initial price total of the sale?"));
commissionRate = Double.parseDouble(JOptionPane.showInputDialog(null, "What is the percentage amount of the sales commission? For example for 20%, type 20."));
discountRate = Double.parseDouble(JOptionPane.showInputDialog(null, "What is the customer's discount rate? For example for a 15% discount, type 15."));
JOptionPane.showMessageDialog(null, "The final cost to the customer is $" + computeFinalPrice(initialPrice, commissionRate, discountRate) + ".");
}
public static String computeFinalPrice (double initialPrice, double commissionRate, double discountRate)
{
double finalPrice;
DecimalFormat d = new DecimalFormat("0.00");
finalPrice = (initialPrice*(commissionRate+100)*.01)*((100-discountRate)*.01);
return (d.format(finalPrice));
}

class Discount

{

public static void main(String args[])

{

double dis,amount,markedprice,s;

Scanner sc=new Scanner(System.in);

System.out.println("enter markedprice ");

markedprice=sc.nextDouble();

System.out.println("enter discount percentage ");

dis=sc.nextDouble();

s=100-dis;

amount= (s*markedprice)/100;

System.out.println("amount after discount="+amount);

}

}

public class EchoInt
{
import java.util.Scanner;

public static void main(String[] args)
{
//Declaration of variables outside the while loop
Scanner scan = new Scanner(System.in); //declaring variables outside of a loop saves space and speeds up execution as the jvm does not need to reallocate space for an object inside the loop.

boolean done = false; //this will be our conditional for the while loop
int input = -1;

while(!done) //while done is equal to false.
{
System.out.println("Please enter a positive int to echo or 0 to exit: ");

if(scan.hasNextInt()) //If the user has inputted a valid int
input = scan.nextInt(); //set the value of input to that int.

else //The scanner does not have a integer token to consume
{
/*
THIS IS IMPORTANT. If the scanner actually does have a token
which was not an int. For example if the user entered a string,
you need to consume the token to prepare to accept further tokens.
*/
if(scan.hasNext())
scan.next(); //Actually consumes the token

input = -1; //This is used to indicate that an invalid input was submitted
}

if(input == 0) //The user chose to exit the program
done = true; //set done to true to kick out of the while loop

else if(input == -1) //This means the user inputed an invalid input
System.out.println("ERROR! Try again."); //show error message

else //The user inputted valid input
System.out.println("echo: "+input); //Echo the int

}

scan.close(); //We are done, so close the scanner
System.out.println("Exiting. Goodbye!"); //Show a goodbye message
System.exit(0); //exit the program. The zero tells us we exited without errors.
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote