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).
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
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. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
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
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