Question: Learning Objectives: Get familiar with the + - / * and % operators. Get Familiar with reading strings. Understand the use of variables in a

Learning Objectives:

  1. Get familiar with the + - / * and % operators.
  2. Get Familiar with reading strings.
  3. Understand the use of variables in a program.
  4. Understand how expressions are developed.
  5. Understand basic debugging strategies.
  6. Apply strategies learnt to more complex real-world problems.

For each part you MUST clearly indicate (comment) the beginning of the INPUT, PROCESSING and OUTPUT sections of your code.

Q1:

Write a program to request a students name and marks in 4 subjects. The program must print the name, total marks and average mark, appropriately labeled.

Q2:

Write a program to calculate electricity charges for a customer. The program requests a name, previous meter reading and current meter reading. The difference in the two readings gives the number of units of electricity used. The customer pays a fixed charge of $25 plus 20 cents for each unit used.

Print all the data, the number of units used and the amount the customer must pay, appropriately labelled

Q 3:

Modify part 2 so that the program requests the fixed charge and the rate per unit.

Q 4:

Write a program which, given a length in inches, converts it to yards, feet and inches. (1 yard = 3 feet, 1 foot = 12 inches). For example, given 100 inches, the program should print 2 yd 2 ft 4 in. Hint: use the mod operator.

Work with another person to create a program that satisfies the requirements of the program specified above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!