, , , ,

[SOLVED] Cse1322 assignment 1- (fall 2025) p0

$25

File Name: Cse1322_assignment_1___fall_2025__p0.zip
File Size: 339.12 KB

5/5 - (1 vote)

Introduction
In this assignment, you will write a simple program to help a small theater sell movie tickets and confections, as well as keep track of its balance and prices. This program must allow prices to be updated, despite the number and type of goods never changing.
Requirements
The features described below must be in your program:
• Your main method must keep track of the following, using appropriate data types:
o The number of available seats, which starts at 50 o The price of a ticket, which starts at $30 o The price of popcorn, which starts at $25 o The price of soda, which starts at $10 o The price of candy, which starts at $15 o The theater’s current balance, starting at $0
• Your main method must implement a menu with the following options:
o Sell tickets: Prompts the user for the number of tickets to sell. If there are enough seats available, update the number of available seats and the theater’s balance. If there aren’t enough seats, do update the balance or the number of seats available; print an error message instead.
▪ E.g.: If the theater has 10 seats available, a balance of $10, and each ticket is $5, selling 5 tickets will decrease the number of seats to 5 and increase the balance to $35. If the theater then tries to sell 7 tickets, the sale will fail: the balance will remain $35, and the number of seats remains 5. o End movie session: Resets the number of available seats back to 50.
o Change ticket price: Prompts the user for the new price of a ticket, updating the appropriate variable. o Sell confection: Prompts the user if they want to sell POPCORN, SODA, or CANDY. Depending on which option is picked, increments the balance using the chosen confection’s price.
o Change price of confection: Prompts the user for the confection whose price they would like to update. Then, prompts the user for the new price, updating the appropriate variable.
o View balance: Shows the theater’s current balance. o View prices: Shows the current price of a ticket and of each individual confection.
o Quit: Terminates the program.

Deliverables
• Assignment1.java (driver)
Considerations
• Be mindful of the data types you will use for each variable. Ask yourself what values are acceptable for that variable to hold, and that will usually tell you what data type should be used.
• Remember that, unless stated otherwise, you should prefer to use “int” for data which will hold whole numbers and “double” for data that will hold numbers with a decimal component.

Sample Output (user input in red)
[Movie Theater Manager]
1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 6

Current balance is $0.00

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 1

Sell how many tickets? 30
Sold 30 tickets at $30.00 for a total of $900.00

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 1

Sell how many tickets? 25
Unable to sell 25 tickets: Only 20 seats available.

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 3

Enter new ticket price: $45.50 Ticket price updated.

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 1

Sell how many tickets? 15
Sold 15 tickets at $45.50 for a total of $682.50

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 2

All seats have been vacated and cleaned.

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 1

Sell how many tickets? 42
Sold 42 tickets at $45.50 for a total of $1911.00

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit Enter option: 7 Current prices:
Ticket: $45.50
Popcorn: $25.00
Soda: $10.00
Candy: $15.00

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 4

Sell what confection?
1. Popcorn
2. Soda
3. Candy
1
Sold POPCORN for $25.00

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 5

Change price of which confection?
1. Popcorn
2. Soda
3. Candy
3
Enter new CANDY price: $17.25 CANDY price updated.

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 4

Sell what confection?
1. Popcorn
2. Soda
3. Candy
3
Sold CANDY for $17.25

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 6

Current balance is $3535.75

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 7 Current prices: Ticket: $45.50
Popcorn: $25.00
Soda: $10.00
Candy: $17.25

1. Sell tickets
2. End movie session
3. Change ticket price
4. Sell confection
5. Change price of confection
6. View Balance
7. View prices
8. Quit
Enter option: 8

Shutting off…

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Cse1322 assignment 1- (fall 2025) p0[SOLVED] Cse1322 assignment 1- (fall 2025) p0
$25