Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions