Needs to be in MIPSzy only. The program you will develop needs to accept input from a source, run the input through several comparisons, and then calculate an output. You will use variables, assignments, if-else functions, and arrays.In this scenario, you need to create a program that will take a user's age and determine a ticket price based on their age.The standard ticket price is $10.00.Minors (those under the age of 18) will pay $1.00 less than the standard ticket price.Seniors (those over the age of 65) will receive a 15% discount.
Question
Needs to be in MIPSzy only. The program you will develop needs to accept input from a source, run the input through several comparisons, and then calculate an output. You will use variables, assignments, if-else functions, and arrays.In this scenario, you need to create a program that will take a user's age and determine a ticket price based on their age.The standard ticket price is 1.00 less than the standard ticket price.Seniors (those over the age of 65) will receive a 15% discount.
Solution
Here is a simple MIPS assembly language program that implements the given scenario:
.data
age: .word 0
price: .float 10.0
discount: .float 0.15
minors_price: .float 9.0
seniors_price: .float 0
.text
.globl main
main:
# Prompt for user's age
li $v0, 5
syscall
sw $v0, age
# Load age into a register
lw $t0, age
# Check if user is a minor
li $t1, 18
blt $t0, $t1, minor
# Check if user is a senior
li $t1, 65
bgt $t0, $t1, senior
# If not a minor or senior, price is standard
lwc1 $f12, price
j end
minor:
# If minor, price is $1 less than standard
lwc1 $f12, minors_price
j end
senior:
# If senior, price is 15% less than standard
lwc1 $f12, price
lwc1 $f13, discount
mul.s $f12, $f12, $f13
sub.s $f12, $f12, $f13
swc1 $f12, seniors_price
lwc1 $f12, seniors_price
end:
# Print the ticket price
li $v0, 2
syscall
# Exit the program
li $v0, 10
syscall
This program first prompts the user for their age, then checks if they are a minor or a senior. If they are a minor, the ticket price is set to $1 less than the standard price. If they are a senior, the ticket price is set to 15% less than the standard price. If they are neither a minor nor a senior, the ticket price is the standard price. The ticket price is then printed to the console.
Similar Questions
The program you will develop needs to accept input from a source, run the input through several comparisons, and then calculate an output. You will use variables, assignments, if-else functions, and arrays.In this scenario, you need to create a program that will take a user's age and determine a ticket price based on their age.The standard ticket price is $10.00.Minors (those under the age of 18) will pay $1.00 less than the standard ticket price.Seniors (those over the age of 65) will receive a 15% discount.
Develop a Java program for a ticket pricing system. Prompt the user to enter their age and the type of ticket they want to purchase (1 for regular, 2 for VIP). Use if-then-else statements to calculate the ticket price based on the following criteria:Regular Ticket Prices:Age 0-5: FreeAge 6-12: $10Age 13-18: $15Age 19 and above: $20VIP Ticket Prices:Age 0-5: $5Age 6-12: $15Age 13-18: $20Age 19 and above: $30
Consider a ticket reservation system that allows users to book tickets for various destinations. Each ticket has details such as passenger name, destination, ticket price, and passenger age. The ticket prices are calculated based on the passenger's age, with children (age <= 12) receiving a 50% discount, senior citizens (age >= 60) receiving a 30% discount, and others paying the regular price. The system also tracks the confirmation status of each ticket.Design a Java program that implements this ticket reservation system. The program should prompt the user to input details for multiple tickets, including passenger name, destination, ticket price, and passenger age. It should then calculate and display the total amount of tickets booked for confirmed tickets alone, considering the discounted prices based on passenger age.Write the Java code for the ticket reservation system and demonstrate its functionality with a sample input/output scenario.Sample Input: 3 //No of tickets to book Ravi // NameDelhi // Destination2000 // Price70 // Age Manu // NameDelhi // Destination2000 // Price9 // Age Priya // NameDelhi // Destination2000 // Price40 // Ageconfirm // Do you want to confirm or cancel ticket 1? (confirm/cancel)cancel // Do you want to confirm or cancel this ticket 2? (confirm/cancel)confirm // Do you want to confirm or cancel this ticket 3? (confirm/cancel)Sample Output:3400.0 // Total Amount of Confirmed Tickets
evelop a Java program to determine the eligibility of applicants for a seniorcitizen discount based on their age. Prompt the user to input their age. Usecontrol statements to check if the applicant meets the minimum agerequirement (e.g., 60 years). Implement operators to perform the necessarycomparisons and logical operations. Display appropriate messages to informthe user whether they are eligible for the senior citizen discount or not basedon the conditions met
Single File Programming QuestionProblem StatementIn a theme park, only people who meet specific criteria can experience the thrill of the roller coaster. Develop a program that takes age and height as inputs, determining eligibility using logical operators. If the age is 18 or older and the height is 150 cm or taller, output "Allowed!" Otherwise, output "Sorry, Not allowed."Input format :The first line of input consists of an integer, which represents the person's age.The second line of input consists of an integer, which represents the person's height (in cm).Output format :The output displays either "Allowed!" or "Sorry, Not allowed" based on the given conditions.Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:6 ≤ age ≤ 10050 ≤ height ≤ 200Sample test cases :Input 1 :28151Output 1 :Allowed!Input 2 :17151Output 2 :Sorry, Not allowedInput 3 :6200Output 3 :Sorry, Not allowedInput 4 :18150Output 4 :Allowed!
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.