a program that converts

Spring 2022, CS 1200-03
Assignment #4
Problem 1:
Write a program that converts a positive integer into the Roman number system. The
following are numerals of the Roman number system:
Roman Arabic
Numbers Numbers
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
From I we can make Roman numeral II by adding two I’s. Similarly we can write Roman
numeral III by adding three I’s. Roman equivalent of 4 is written by writing IV (that is I to
the left of Roman V). You are given Roman fve. Roman six can be written using Roman V
followed by Roman I, Roman seven is a combination of Roman V followed by two Roman Is.
Similarly, Roman eight is Roman V followed by three Roman Is. Roman nine is a combination of Roman I followed by Roman ten, X. There is no symbol for 0 in Roman system. When
Roman I precedes a Roman V or Roman X, that one is subtracted from 5 and 10 respectively.
The ones that follow Roman V are added to fve. The Is following the X are added to the ten.
I (1), II (2), III (3), IV (4), V (5), VI (6), VII (7), VIII (8), IX (9) – multiples of one
You can similarly build multiples of ten X, multiples of hundred and multiples of thousand.
You have to combine with X, with all ones place numbers to get to XX. To get a 11, you
need (10 + 1) which is written as XI. Similarly, 12 is XII (10 + 2), 13 is XIII, 14 is XIV
that is (10+4). The symbol X appears in all multiples of ten. At most you can 3 tens in a
two digit number.
Only numbers from 1 to 3999 are represented in the Roman System.
Please only defne the seven Roman numbers as constants. All others should be made in the
code.
If a user enters 8, your program should print VIII.
If a user enters 87, your program should print LXXXVII.
If a user enters 878, your program should print DCCCLXXVIII.
If a user enters 1936, your program should print MCMXXXVI.
Any student that uses loops in this problem will be assigned a score of
zero. Just use
multi-way if/ else if statements. Please write a pseudocode and submit with the program.
1

Problem 2:
It is important to consider the effect of thermal expansion when building a structure that
must withstand changes in temperature. For example, a metal beam will expand in hot
temperatures. The additional stress could cause the structure to fail. Similarly a material
could contract in cold temperatures. The linear change in length of a material if it is allowed
to freely expand is given by the following equation:
L= α0T
Here L0 is the initial length of the material in meters. Lis the displacement in meters
(which can be positive or negative),
Tis the change in temperature in Celsius (in summer
it is positive, and in winter it is negative), and
α is coefcient of linear expansion.
Here are some values of
α for different materials.
Table 1: Coefcient of Linear Expansion Table

Material Coefcient of
Linear Expansion
/0C

Aluminum 2.31 × 105
Copper 1.70 × 105
Glass 8.50 × 106
Steel 1.20 × 105
Write a program that displays a menu allowing the user to select one of the four solids.
After selection the user should input the length of material in
L0 in meters, and change in
temperature
Tin degrees Celsius and , then calculate and output the material’s name and
the amount of linear change in length which can be positive or negative.
Problem 3:
A bank charges $10 per month plus the following check fees for a commercial checking
account:
$0.10 each for fewer than 20 checks
$0.08 each for 20 – 39 checks
$0.06 each for 40 – 59 checks
$0.04 each for 60 or more checks.
The bank also charges an extra $15 if the balance of the account falls below $400 (before
any check fees are applied). Write a program that asks for the beginning balance and the
number of checks written. Compute and display the bank’s service fees per month.
The assignment is due on Saturday, April 9, 2022 by 5 PM.
2