Code Monkey home page Code Monkey logo

cinemaroommanager's Introduction

CinemaRoomManager

CinemaRoomManager

Description Running a cinema theatre is no easy business. To help our friends, let's add statistics to your program. The stats will show the current income, total income, the number of available seats, and the percentage of occupancy.

In addition, our friends asked you to take care of a small inconvenience: it's not good when a user can buy a ticket that has already been purchased by another user. Let's fix this!

Objectives Now your menu should look like this:

  1. Show the seats
  2. Buy a ticket
  3. Statistics
  4. Exit When the item Statistics is chosen, your program should print the following information:

The number of purchased tickets; The number of purchased tickets represented as a percentage. Percentages should be rounded to 2 decimal places; Current income; The total income that shows how much money the theatre will get if all the tickets are sold. The rest of the menu items should work the same way as before, except the item Buy a ticket shouldn't allow a user to buy a ticket that has already been purchased.

If a user chooses an already taken seat, print That ticket has already been purchased! and ask them to enter different seat coordinates until they pick an available seat. Of course, you shouldn't allow coordinates that are out of bounds. If this happens, print Wrong input! and ask to enter different seat coordinates until the user picks an available seat.

Examples The greater-than symbol followed by a space (> ) represents the user input. Note that it's not part of the input.

Enter the number of rows:

6 Enter the number of seats in each row: 6

  1. Show the seats
  2. Buy a ticket
  3. Statistics
  4. Exit

3

Number of purchased tickets: 0 Percentage: 0.00% Current income: $0 Total income: $360

  1. Show the seats
  2. Buy a ticket
  3. Statistics
  4. Exit

2

Enter a row number:

1 Enter a seat number in that row: 1

Ticket price: $10

  1. Show the seats
  2. Buy a ticket
  3. Statistics
  4. Exit

3

Number of purchased tickets: 1 Percentage: 2.78% Current income: $10 Total income: $360

  1. Show the seats
  2. Buy a ticket
  3. Statistics
  4. Exit

2

Enter a row number:

1 Enter a seat number in that row: 1

That ticket has already been purchased!

Enter a row number:

10 Enter a seat number in that row: 20

Wrong input!

Enter a row number:

4 Enter a seat number in that row: 4

Ticket price: $10

  1. Show the seats
  2. Buy a ticket
  3. Statistics
  4. Exit

1

Cinema: 1 2 3 4 5 6 1 B S S S S S 2 S S S S S S 3 S S S S S S 4 S S S B S S 5 S S S S S S 6 S S S S S S

  1. Show the seats
  2. Buy a ticket
  3. Statistics
  4. Exit

3

Number of purchased tickets: 2 Percentage: 5.56% Current income: $20 Total income: $360

  1. Show the seats
  2. Buy a ticket
  3. Statistics
  4. Exit

0

cinemaroommanager's People

Contributors

edg4rv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.