CSC / CIS 175 Problem Solving and Programming – I Homework 2

$40.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Questions for the deliverable:
1. Write a program that inputs a five-digit integer, separates the integer into its individual digits
and prints the digits separated from one another by tab length. Hint: Use integer division
and modulus operator.
For example, if the user types in 66095, the program should print
6 6 0 9 5
00021 as input should give
0 0 0 2 1
2. Using only the techniques we covered so far, write a program that calculates the squares and
cubes of the five integers input from the keyboard by the user and prints a table whose first
column has the five integers entered, second column corresponding squares of the first column
and third the cubes. Use tabs to separate the columns.
Expected Output:
Enter 1st Integer : 2
Enter 2nd Integer : 4
Enter 3rd Integer : 23
Enter 4th Integer : 34
Enter 5th Integer : 5
Int Sqr Cube
2 4 8
4 16 64
23 529 12167
34 1156 39304
5 25 125
3. A county collects property tax on the assessment value of property, which is 60% of the
property’s actual value. If an acre of land is valued at $10000, then its assessment is $6000.
The property tax is then 64 cents for each $100 of the assessment value. The tax for the acre
assessed at $6000 will be $38.40. Write a program that asks for the actual value of a piece of
property and displays the assessment value and property tax.
Expected Output:
Enter the market value for the property : 10000
Property Tax for the market value of $10000 is $38.4
4. What is the two’s complement representation for
int neg num = -119;
if the computer is representing integers with 4 bytes.
(No programming for this question).
5. A bag of cookies holds 50 cookies. The nutrition facts from the bag reports that there are 10
servings in the bag and a serving is about 300 calories. Write a program that asks the user
to input how many cookies (s)he actually ate and then report the total calories consumed.
Expected Output:
Enter the number of cookies you ate : 4
You have consumed 240 calories!
Enter the number of cookies you ate : 50
You have consumed 3000 calories!
2
Deliverables:
1. Source Code: (.cpp file) that must start with a comment block similar to the following:
/*************************************************************************
** Author : Suleyman Uludag
** Program : hw1, q1
** Date Created : September 15, 2013
** Date Last Modified : September 16, 2013
** Usage : No command line arguments
**
** Problem:
Accept the following information from the user (keyboard):
– Hw1, hw2 and hw3 (out of 100)
– Midterm (out of 100)
– Final exam (out of 100)
Calculate the total grade out of 100 based on the following grading scale:
Hws –> 30% (10% each)
Midterm –> 30%
Final Exam –> 40%
** Pseudocode:
** 1)
** 2)
*************************************************************************/
2. Executable (.exe file under windows). You must explicitly state the platform of your executable (such as Linux, etc.) if it is not Windows. Please name your file by using the
question number: hw1-q1.exe (for Windows)
3. Screenshot of your app. For screenshot, you can use the following free program on windows:
http://www.wisdom-soft.com/downloads/setupscreenhunterfree.exe
For Linux/Unix, there are many alternatives. I personally like shutter.
File naming convention example:
hw1 q1.png (or .jpg or another graphics format)
4. You must zip all the above three files into ONE .zip file and submit your assignment by the
deadline on moodle system. Name your file as Lastname-Firstname-hw#.zip. For example,
Uludag-Suleyman-hw1.zip
For generating .zip file, you may use the following free software on Windows:
http://www.7-zip.org/download.html
Linux/Unix has many built-in.
3