CS110 C++ Programming Assignment #2

Instructor: Trish Cornez

  Instructions - Complete the following before the start of class:
  1. Code, debug, comment, and print the source code for each program. All programs must contain your name, date, a program message, and code comments. Points will be deducted on programs that are not well coded and commented and pages that are unstapled.
  2. Execute each program three times with the input supplied. Program 3 should execute just once.
  3. Print the output from all executions (use ALT PrintScreen to capture the output window and then paste into Wordpad or MS Word).

Angles are often measured in degrees, minutes, and seconds. There are 360 degrees in a circle, 60 minutes in one degree, and 60 seconds in one minute. Write a program that reads two angular measurements given in degrees, minutes, and seconds, and then calculates and prints their sum. Constants are required for this program.

Use your program to verify the following :

Measurement #1
        Enter the degrees: 74
        Enter the minutes: 29
        Enter the seconds: 13

Measurement #2
        Enter the degrees: 105
        Enter the minutes: 8
        Enter the seconds: 16
The sum of measurement #1 and measurement #2 is 179 degrees, 37 minutes, and 29 seconds

Measurement #1
        Enter the degrees: 7
        Enter the minutes: 14
        Enter the seconds: 55

Measurement #2
        Enter the degrees: 5
        Enter the minutes: 24
        Enter the seconds: 55
The sum of measurement #1 and measurement #2 is 12 degrees, 39 minutes, and 50 seconds

Measurement #1
        Enter the degrees: 1
        Enter the minutes: 17
        Enter the seconds: 48

Measurement #2
        Enter the degrees: 237
        Enter the minutes: 42
        Enter the seconds: 12
The sum of measurement #1 and measurement #2 is 239 degrees, 0 minutes, and 0 seconds


The shipping clerk at the Redlands Handcrafted Bike Shop is faced with the following problem:

Write an interactive C++ program that reads the number of handcrafted bikes to be shipped and prints the number of large, medium, and small containers needed to send the shipment in the minimum number of containers and with the minimum amount of wasted space.
TIP: Use contants for the number of bikes each size of container can hold.
Execute this program three times and use the following numbers for input: 3, 48, and 10598.

Here is an example of a possible run:

How many handcrafted bikes will be shipped? 26

You will need 2 large containter(s), 1 medium container(s), and 1 small container(s)


Write a program that performs long multiplication.
  1. Prompt the user for a three digit integer x
  2. Prompt the user for a two integer y
  3. Compute x multiplied by y using a similar display as follows:
    NOTE: setw can be used to perform right alignment.

    PROGRAM 4:

    Write a program that does the following:
    1. causes a negative overflow of an int
    2. causes a positive overflow of an int
    Write a few words explaining your results.