OUTPUT FORMATTING

 

Problem # 1

 

Write a program which will read the length and width of a rectangle and then find its perimeter.

 

            LENGTHo=ooooXX.XX

     WIDTHo=oooooXX.XX

     PERIMETERo=oXX.XX

 

where each o represents one blank

 

Problem # 2

 

Write a program which will read the length and area of a rectangle and then find its perimeter. Your output should be in the form:

 

            LENGTHo=ooooXX.XX

 

     AREAo=ooooooXX.XX

 

     PERIMETERo=oXX.XX

 

where each o represents one blank

 

NOTE:  DONT USE THE X FORMAT SPECIFICATION

 

Problem # 3

 

Write a program which will read the surface area, length, and width of a closed box and then find its volume. Your output should be in the form:

 

LENGTHo=oooooooXX.XXXooWIDTHo=oooXX.XXX

SURFACEAREAo=oXXX.XXXooVOLUMEo=oXXX.XXX

 

where each o represents one blank

 

 

Problem # 4

 

Write a program that reads a weight in pounds and converts the weight to kilograms. (One kilogram = 2.2 pounds).

 

The output should be as follows:

 

            THEoWEIGHToINoPOUNDSo=XX.XXXXX

     THEoWEIGHToINoKILOGRAMSo=XX.XXXXX

 

where each o represents one blank

 

 

Problem # 5

 

Write a program that reads a measurement in pounds and converts it to kilograms and ounces. ( 1 kilogram = 2.2046 pounds, 1 kilogram = 35.27 ounces).

 

Use the following data:  80.0

 

Your output should be in the form:

 

            POUNDSooooKILOGRAMSooooOUNCES

     o80.0ooooooo36.3ooooooo1279.9

 

where each o represents one blank

 

Problem # 6

 

Write a program that reads a measurement in kilowatt-hours (kWh) and converts it to joules and calories. ( 1 kWh = 0.2778 * 10 -6 joules, 1 calorie =  4.19 joules).

 

Use the following data:  5.5

 

Your output should be in the form:

 

            5.50ooKILOWATT-HOURSo=o0.00000153ooJOULES

     5.50ooKILOWATT-HOURSo=o0.000000365oCALORIES

 

where each o represents one blank

 

 

Problem # 7

 

Write a program that reads a distance measured  in miles and converts the distance to kilometers. One kilometer = 1.6 mile.

 

The output should be as follows:

 

            THEoDISTANCEoINoMILESo=oooooXX.XXX

     THEoDISTANCEoINoKILOMETERSo=XX.XXX

 

where each o represents one blank

           

Problem # 8

 

Write a program which prompts for, and reads an amount in Riyals and converts it into Dollars. Your output should be in the form:

 

            XXX.XXoRIYALSo=oXXX.XXoDOLLARS

 

where each o represents one blank

 

Note: 1 Dollar = 3.75 Riyals

 

Use the data:

752.00

 

Your output should be:

 

752.00 RIYALS = 200.00 DOLLARS

 

 

Problem # 9   

 

Write a FORTRAN77 program that reads the coordinates of two points (X1 , Y1) and       (X2 , Y2). Find the distance between the points. Your output should be in the form:

 

DISTANCEoBETWEENo(XX.XXo,oXX.XX)oANDo(XX.XXo,oXX.XX)oIS:

XXX.XX

 

where each o represents one blank

 

Problem # 10

 

Write a program which reads the volume  v of a sphere and then computes the radius r and the surface area s of that sphere.

 

USE THE DATA:  25.0

 

Your output should be in the form:

 

                       RADIUSo=o1.81ooCM

               VOLUMEo=o25.00ooCMoCUBED

               SURFACEoAREAo=o41.35ooCMoSQUARED

 

where each o represents one blank

 

  NOTE:     v = 4.0 / 3pr3    ,  s = 4pr2      , p = 3.14159

 

Problem # 11

 

Write a program which reads the volume v of a right circular cylinder of height 3r2 where r is the radius. The program then computes the radius and the surface area s of that cylinder.

 

USE THE DATA: 100.0

 

Your output should be in the form:

 

                                    RADIUSo=o1.80ooCM

               VOLUMEo=o100.00ooCMoCUBED

               SURFACEoAREAo=o55.41ooCMoSQUARED

 

where each o represents one blank

 

NOTE:

             v  =  3pr 4     ,  s = 3pr3   ,    p = 3.14159

 

 

Problem # 12

 

Write a program to compute the surface area and the volume of a sphere given its radius.

 

NOTE:

             s = 4pr 2     ,  v = 4.0 / 3pr3   ,    p = 3.14159

 

Use the data:

3.2

 

Your output should be:

 

RADIUSo=o3.2ooCM

SURFACEoAREAo=o128.7ooCMoSQUARED

VOLUMEo=o137.3ooCMoCUBED

 

where each o represents one blank

 

 

Problem # 13

 

Write a program which reads the surface area s of a right circular cylinder of height     r / Ö 3.0 where r is the radius. The program then computes the radius r and the volume v of that cylinder. (Note: You don’t have to use r / Ö 3.0 , just use the formulas given below)

 

Use the data: 155.0

 

Your output should be in the form:

 

RADIUSo=o6.53ooCM

SURFACEoAREAo=o150.00ooCMoSQUARED

VOLUMEo= o506.49ooCMoCUBED

 

NOTE:                      ___                                ___

            v  =  pr 3  /  Ö 3.0  ,      s  =  2pr 2  /  Ö 3.0  ,    p  =  3.14159

 

where each o represents one blank

 

Problem # 14

 

Write a FORTRAN program that  reads a diameter d of a circle in meters.  Compute the radius r, circumference C, and area A of the circle.  Print the computed values in the following form:

PROPERTIESoOFoAoCIRCLEoWITHoDIAMETERooXXXX.XXXoMETES

(1)oooRADIUSo=oXXXX.XXXoMETERS (2)oooCIRCUMFERENCEo=oXXXX.XXXoMETERS (3)oooAREAo=oXXXXX.XXXXoSQRoMETERS

 

where each o represents one blank

 

NOTE:                                                

            r  =  d / 2 ,     A  =  pr 2    ,       C  =  2pr  ,      p  =  3.14159

Problem # 15

 

Write a FORTRAN program that reads a measurement in meters.  Print the value followed by the unit for meters, centimeters, and kilometers.  Your output should be triple spaced and looks like the following:

 

Theoamountoisoxxxx.xxxoometers

 

 

Theoamountoisoxxxxxx.xoocentimeters

 

 

Theoamountoisox.xxxxxxooKILOMETERS

 

 

where each o represents one blank

 

 

Problem # 16

 

Write a program that reads numbers that represents side measurements of rectangles. The measurements are terminated by the sentinel 0.0  0.0.  For each rectangle, the program should determine which side is the length and which side is the width.  Your program should print, for each rectangle, an output of the form:

 

Rectangle#x:oolengtho=oxx.xx,oowidtho=oxx.xxx,ooareao=oxxx.xxxx

 

where each o represents one blank

 

use single spacing for your output.

 

Use the following data:

20.0     30.0

50.5     15.5

12.6     42.3

56.7     11.4

  0.0       0.0

 

 

Problem # 17

 

Write a program that reads two integer matrices A and B of size 3x3 then it calculates the matrix C which is A + B. Print the three matrices with suitable headings  as follows:

1.      start printing A in a new page;

2.      leave 3 lines between A and B;

3.      leave 6 lines between B and C;

4.        print each element of the arrays in 5 places, and 2 spaces from the next element;