logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

Write a program that takes from user the number of cinema tickets he wants to buy, and then calculates and displays the total cost of buying them according to the prices above.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

INTRODUCTION TO COMPUTER SCIENCE IT

EXAM I – if – switch – loops

Exercise 1. (If)

The price of one cinema ticket is:

  • 7 Euro when you buy only 1 ticket

  • 6 Euro when you buy from 2 to 3 tickets

  • 5 Euro when you buy from 4 to 6 tickets

  • 4 Euro when you buy more than 6 tickets

Write a program that takes from user the number of cinema tickets he wants to buy, and then calculates and displays the total cost of buying them according to the prices above.

When user enters an incorrect number of tickets, the program should display „The number of tickets cannot be negative”.

Exercise 2. (Switch)

Write a program that allows the user to enter a month number (we expect number between 1 and 12) and then displays how many days are in the corresponding month (e.g. if the user enters 3 the program should display

„March consists of  31  days”). Notice that  if  the  user  inputs  2  the program  should  display

„February consists of 28 days in a common year and 29 days in a leap year”. If the user enters a number that isn't in the range from 1 to 12, it prints the message "The number does not represents any month of a year".

Exercise 3. (Loops)

Write a program that keeps taking in integers from user until a negative integer is given to stop. Then take all the positive integers that have been entered and get the average of them all.

Exercise 4. (Loops)

Write a program that displays a multiplication table size n x n (take n from user).

really quickly

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Atharva PatilComputer science

992 Answers

Hire Me
expert
Chrisantus MakokhaComputer science

683 Answers

Hire Me
expert
AyooluwaEducation

636 Answers

Hire Me
expert
RIZWANAMathematics

899 Answers

Hire Me

Get Free Quote!

379 Experts Online