Assignment 2 Solution






  1. Read Lesson 2


  1. Read text chapter 2


For Credit


Assignment 2.1 [20 points]


Complete the MyProgrammingLab exercises for chapter 2.


I am hoping that you will all be able to complete these exercises. They are a great way to learn the concepts. This is my first time using MyProgrammingLab and I’m still a little uncertain about how things work and whether I have things set up correctly. So if you register for the site and begin working on the exercises, please let me know how it goes!!


To register for the site you’ll need two things: a course ID and a MyProgramming access code kit. Our course ID is COFS-19764-RDNE-25. I think your MyProgrammingLab access code comes packaged with your text, but don’t confuse it with the access code that is printed on the inside cover of your text and gives you access to the text’s companion website.


Go to and click the button to register. Your assignment is to do all of the exercises from chapter 2.


Assignment 2.2 [25 points]


Write a program that asks the user for an amount of money (entered in cents) and then tells the user how to make change for that amount using only quarters, dimes, nickels, and pennies. Use the strategy used in lesson 2.2 (e.g., you must use the modulus operator), and format your output exactly as in this sample screen output. Note that the pennies must be output first.


enter number of cents: 119

pennies: 4

nickels: 1

dimes: 1


quarters: 4


Assignment 2.3 [25 points]


Write a program that accepts the temperature in degrees Celsius and computes the temperature in Fahrenheit. The formula for converting Celsius to Fahrenheit is, in algebraic language,


F = (9/ 5)C + 32.


Sample screen output:


enter degrees Celsius: 30

30 degrees Celsius is 86 degrees Fahrenheit.

Submit Your Work

Execute each program and copy/paste the output into the bottom of the corresponding source code file, making it into a comment. Send an email to with the subject “CIS 254 a2”. Attach your source code file(s) to the email. In the body of the email let me know whether the programs work as required.


Keep in mind that if your code does not compile you will receive a 0.


Note that the gmail email account is for homework submission only. The account is not monitored for any other purpose.


Assignment 2.4 [5 points]


Participate in the lesson 2 discussion. This could involve asking a question, answering another student’s question, giving an example of something that you struggled with and then overcame (or didn’t!), giving an example of something you found particularly cool, or any other constructive way you can think of to participate.

error: Content is protected !!