Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a MIPS assembly language program that reads some ticket purchase information from a customer, whether they are daytime tickets, or night light tickets, how
Write a MIPS assembly language program that reads some ticket purchase information from a customer, whether they are daytime tickets, or night light tickets, how many adult tickets and child tickets they need. For daytime tickets, customers need to enter 1, for night light tickets, they need to enter 2. If customers enters another number besides 1 or 2, the program should display "Invalid admission." and your program should exit. If the number of adult tickets is less than 0, the number of child tickets is less than 0, or the sum of adult and child tickets is less or equals to 0, then the program should display "Invalid number of tickets." And your program should exit. Each adult ticket for daytime admission is $25, each child ticket for daytime admission is $16, and each adult ticket for night light admission is $20, and each child ticket for night light admission is $10. Your program should compute the total cost and print it along with the number of tickets (people). Your MIPS program needs to work in the same way as the following C program. Please see the sample outputs. int adults, children; int cost; int daynight; int totalPeople; printf("Welcome to our Theme Park! "); printf("Choose 1 for Daytime admission, 2 for NightLights. "); //read an integer from a user input and store it in daynight scanf("%d", &daynight); if (daynight != 1 && daynight != 2) { printf("Invalid admission."); } else { printf("How many adult ticket(s) would you like to purchase? "); 1/read an integer from a user input and store it in adults scanf("%d", &adults); printf("How many child ticket(s) would you like to purchase? "); read an integer fron a user input and store it in children scanf("%d", &children); totalPeople = adults + children; if (adults
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started