Java programming for ticket price calculator. It should ask the user if they would like to process another ticket order. They should indicate their selection with a Y or N. If they indicate yes, then it should repeat the entire program with the exception of the welcome screen. If they indicate no, it should show the final thank you message and end the program. If they indicate an invalid answer, it should display an error and re-prompt them for a Y or N. You should make sure that it will work for all of the following responses: Y, y, N, n. Anything other than those responses would be invalid.●When the user is being prompted for the number of tickets, it should do input validation to make sure that the number entered is not a negative number. If a negative number is entered, it should display an error and re-prompt the user for the number of tickets. This should continue until they give a valid number.●When the user is making a selection from the discount menu, an error message should be displayed and they should be prompted to re-enter their selection if what was entered was not a valid selection. This should continue until they make a valid selection.PROJECT TO DO LIST:⬜Step 1. RequirementsoMake sure you completely understand the requirements and ask questions if you need clarification.oMake sure that you pay close attention to detail and follow the instructions very carefully ☺⬜Step 2. DesignoWrite a pseudocode algorithmor a flowchartfor the solution to the problem. Be specific when mentioning calculations. Remember: your algorithm is your road map –you will follow it when writing your code. DO NOT WRITE YOUR CODE FIRST AND THEN YOUR ALGORITHM/FLOWCHART! (It should NOT be the last thing that you do.)oThis can be a modification of your algorithm for Project 1oTest your algorithm before coding ⬜Step 3. ImplementationoCreate a class calledProject2. Your project should be saved in a folder namedLastnameFirstnameProject2(replace Lastname and Firstname with your own last and first name) ▪Pay attention to your class name. Any class name other than Project 2 will lose points! CSCI1250 Project 2Spring 2019oUse your algorithm as a starting point for your comments throughout your programoWrite your program one step at a time, i.e. make sure one thing works before going on to something else. oComplete the documentation of the application by inserting comments and adhering to programming standards▪Follow 1250 Coding Standards posted on D2L▪Pay particular attention to indenting, no word-wrappingwhen printed and comments⬜Step 4. TestingoTest your program to make sure that it .
Screenshot
-----------------------------------------------------------------------------
Program
import java.util.Scanner;
/*
* Pseudo code
*Step1: Display welcome message
*Step2: Ask for the number of tickets
*First adult ticket count
*Next student/senior ticket count
*Step3:Options for dicount
*Step4: display price for the ticket
*Step5: "Do you want to continue?" loop
*step6: If yes continue
*If no good bye message
*/
public class CSCI1250Project2Spring2019 {
//Fares are fixed
public final static double
ADULT_TICKET_RATE=10.00;
public final static double
OTHER_TICKET_RATE=5.00;
public final static double SHIPPING_CHARGE=5.00;
public final static double DISCOUNT=10.0;
//Methods used
public static void welcomeMessage() {
System.out.println("********
WELCOME TO THE TICKET PRICE CALCULATOR ********");
System.out.println("
CREATED BY YOUR NAME");
System.out.println("\n
Press Enter to continue.......");
}
//Discount menu
public static void discountOption() {
System.out.println("\nUser Saving
Options:-\n1. Enter 1 for free shipping\n2. Enter 2 for 10.0%
discount\n3. Enter 3 for better one of this\n");
}
//Display ticket price
public static void priceDetails(int aCount,int
oCount,int discOpt) {
double
price=0.00,discount,shipping;
price=aCount*ADULT_TICKET_RATE+oCount*OTHER_TICKET_RATE;
if(discOpt==1) {
shipping=0.00;
discount=0.00;
}
else if(discOpt==2)
{
shipping=SHIPPING_CHARGE;
discount=price*(DISCOUNT/100);
price=(price+shipping)-discount;
}
else {
shipping=SHIPPING_CHARGE;
discount=price*(DISCOUNT/100);
if(discount<shipping) {
shipping=0.00;
discount=0.00;
}
else {
price=(price+shipping)-discount;
}
}
System.out.println("\n
PURCHASE INFORMATION\n");
System.out.println("Category
NumberOfTickets
Price Total");
System.out.println("--------------------------------------------------");
System.out.printf("%s%15d%15s%.2f%6s%.2f\n","Adult",aCount,"$",ADULT_TICKET_RATE,"$",aCount*ADULT_TICKET_RATE);
System.out.printf("%s%8d%15s%.2f%6s%.2f\n","Student/Other",oCount,"$",OTHER_TICKET_RATE,"$",oCount*OTHER_TICKET_RATE);
System.out.printf("%s%38s%5.2f\n","Shipping","$",shipping);
System.out.printf("%s%38s%5.2f\n","Discount","$",discount);
System.out.println("----------------------------------------------------");
System.out.printf("%s%38s%5.2f\n","Total Due","$",price);
}
//Main method
public static void main(String[] args) {
//Scanner object for input
read
Scanner sc=new
Scanner(System.in);
//Welcome message
welcomeMessage();
sc.nextLine();
char ch;
int
adultTicketCount,otherTicketCount,opt;
//loop through the
calculator
do {
//Prompt for
adult ticket count
System.out.print("\nEnter the number of tickets for adults(18-64):
");
adultTicketCount=sc.nextInt();
while(adultTicketCount<0) {
System.out.println("\nTicket count should not be
negative!!!!\n");
System.out.print("\nEnter the number of tickets
for adults(18-64): ");
adultTicketCount=sc.nextInt();
}
//Prompt for
other ticket count
System.out.print("\nEnter the number of tickets for
students/seniors(<=17 or >=65): ");
otherTicketCount=sc.nextInt();
while(otherTicketCount<0) {
System.out.println("\nTicket count should not be
negative!!!!\n");
System.out.print("\nEnter the number of tickets
for students/seniors(<=17 or >=65): ");
otherTicketCount=sc.nextInt();
}
//Discount
option
discountOption();
System.out.print("\nEnter your option: ");
opt=sc.nextInt();
while(opt<1
|| opt>3) {
System.out.println("\nOption should be
1...3!!!\n");
discountOption();
System.out.print("\nEnter your option: ");
opt=sc.nextInt();
}
//Method to
display price
priceDetails(adultTicketCount,otherTicketCount,opt);
sc.nextLine();
System.out.print("\nWould like to process another ticket
order(y/n):");
ch=sc.nextLine().charAt(0);
ch=Character.toUpperCase(ch);
while(ch!='Y'&& ch!='N') {
System.out.println("\nOption should be
y/n!!!\n");
System.out.print("\nWould like to process
another ticket order(y/n):");
ch=sc.nextLine().charAt(0);
ch=Character.toUpperCase(ch);
}
}while(ch=='Y');
System.out.println("\n
GOOD BYE!!!!");
}
}
--------------------------------------------------------------------
Output
******** WELCOME TO THE TICKET PRICE CALCULATOR ********
CREATED BY YOUR NAME
Press Enter to continue.......
Enter the number of tickets for adults(18-64): 2
Enter the number of tickets for students/seniors(<=17 or >=65): 2
User Saving Options:-
1. Enter 1 for free shipping
2. Enter 2 for 10.0% discount
3. Enter 3 for better one of this
Enter your option: 2
PURCHASE INFORMATION
Category
NumberOfTickets
Price Total
--------------------------------------------------
Adult
2
$10.00 $20.00
Student/Other
2
$5.00 $10.00
Shipping
$ 5.00
Discount
$ 3.00
----------------------------------------------------
Total
Due
$32.00
Would like to process another ticket order(y/n):k
Option should be y/n!!!
Would like to process another ticket order(y/n):n
GOOD BYE!!!!
Java programming for ticket price calculator. It should ask the user if they would like to process...
C++ programming For this assignment, write a program that will act as a geometry calculator. The program will be menu-driven and should continue to execute as long as the user wants to continue. Basic Program Logic The program should start by displaying a menu similar to the following: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Quit Enter your choice(1-3): and get the user's choice as an integer. After the choice...
JAVA 2. (8 points) Write a code segment which prompts the user to enter the price of a tour and receives input from the user. A valid tour price is between $52.95 and $259.95, inclusive. Your program should continue to repeat until a valid tour price has been entered. If the user enters an invalid price, display a message describing why the input is invalid. You may assume that the user only enters a real number. The user will not...
Write a program that computes the average of a set of grades.
The user is prompted the following:
1-Number of grades to be entered.
2-The value of the minimum grade.
3-The value of the maximum grade.
Make sure to write input validation for the following:
1-The number of grades cannot be negative! In case it is 0, it
means that user has no grades to enter.
2-Each entered grade should be a valid grade between the minimum
and maximum values...
In this exercise, write a complete Java program that reads integer numbers from the user until a negative value is entered. It should then output the average of the numbers, not including the negative number. If no non-negative values are entered, the program should issue an error message. You are required to use a do-while loop to solve this problem. Solutions that do not use a do-while loop will be given a zero. Make sure to add appropriate comments to...
C Programming Quesition (Structs in C): Write a C program that prompts the user for a date (mm/dd/yyyy). The program should then take that date and use the formula on page 190 (see problem 2 in the textbook) to convert the date entered into a very large number representing a particular date. Here is the formula from Problem 2 in the textbook: A formula can be used to calculate the number of days between two dates. This is affected by...
Assignment Develop a program to analyze one or more numbers entered by a user. The user may enter one or more numbers for analysis. Input should be limited to numbers from 1 through 1000. Determine if a number is a prime number or not. A prime number is one whose only exact divisors are 1 and the number itself (such as 2, 3, 5, 7, etc.). For non-prime numbers, output a list of all divisors of the number. Format your...
A Simple Calculator Summary: Write a console program (character based) to do simple calculations (addition, subtraction, multiplication and division) of two numbers, using your understanding of Java. Description: You need to write a program that will display a menu when it is run. The menu gives five choices of operation: addition, subtraction, multiplication, division, and a last choice to exit the program. It then prompts the user to make a choice of the calculation they want to do. Once the...
Use Java program Material Covered : Loops & Methods Question 1: Write a program to calculate rectangle area. Some requirements: 1. User Scanner to collect user input for length & width 2. The formula is area = length * width 3. You must implement methods getLength, getWidth, getArea and displayData ▪ getLength – This method should ask the user to enter the rectangle’s length and then return that value as a double ▪ getWidth – This method should ask the...
Wrote a program called ExceptionalDivide that asks the user for 2 integer values and displays the quotient of the first value divided by the second value. Make sure the your program reads in the two input values as ints. Your program must catch either of two exceptions that might arise and crash your program java.util.InputMismatchException //wrong data type inputted java.lang.ArithmeticException //divide by zero error Once you catch these exceptions, your program must print out a message explaining what happened and...
USING PYTHON - Write a program that calls a function that prompts the user to enter a real number. The function should verify that the user entered a valid real number, and should prompt the user to re-enter any invalid input. After a valid real number has been entered, the function should return the number as a number. To test your function, from a main function, call the function two separate times and print the sum of the two numbers...