2. Areas of Rectangles
The area of a rectangle is the rectangle's length times its width. Write a program that asks for the length and width of two rectangles. The program should tell the user which rectangle has the greater area, or if the areas are the same.
Scientists measure an object's mass in kilograms and its weight in newtons. If you know rhe amount of mass of an object in kilograms, you can calculate its weight in newtons with the following formula:
Write a program that asks the user to enter an object's mass, and then calculates its weight. If the object weighs more than 1000 newtons, display a message indicating that it is too heavy. IT the object weighs less than 10 newtons, display a message indicating that it is too light.
Serendipity Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows:
• If a customer purchases 0 books, he or she earns 0 points.
• If a customer purchases 1 book, he or she earns 5 points.
• If a customer purchases 2 books, he or she earns 15 points.
• If a customer purchases 3 books, he or she earns 30 points.
• If a customer purchases 4 or more books, he or she earns 60 points.
Write a program that asks the user to enter the number of books that he or she has purchased this month and displays the number of points awarded.
5. Software Sales
A software company sells a package that retails for $99. Quantity discounts are given according to the following table:
Was this article helpful?