Sale!

COP 3223 Assignment 2 Introduction to C Programming Solved

Original price was: \$40.00.Current price is: \$35.00.

Category:

5/5 - (1 vote)

Objectives

1. To give students practice at typing in, compiling and running simple programs.
2. To reinforce knowledge of assignment statements and arithmetic expressions

Introduction: Programmers for a Better Tomorrow

Programmers for a Better Tomorrow is an organization dedicated to helping charities, medical
societies, and scholarship organizations manage various tasks so that they can focus on making
the world a better place! They have asked you and your classmates to help them develop some
new programs to benefit their organizations.

Problem: Knitting for Fun and Non-Profit Part 2 (knit2.c)

One of the programs that Programmers for a Better Tomorrow supports knits hats, sweaters,
and blankets for people who may not have enough to keep them warm. These may be sent to
other places in the country or overseas.
Each donated blanket is made from 60 knitted squares. These blanket squares are simple and
can be made in one day. The BlanketSquares program is becoming very popular and the
number of squares made every day is increasing at an exponential rate.

In this program, you will track the number of squares being made in one week using the
exponential growth function (shown below).
ππ = ππ(1 + ππ)π‘π‘
a represents the initial population, this is the number of people already making blanket squares
on the first of the week. b represents the growth rate, this is the number of new people knitting
blanket squares each day. t represents the time interval, which is 7 days for our program.

Your program should calculate X β the number of squares made this week β and print that
information for the user.
Then, your program should calculate the number of blankets that can be made from these
squares. Print this information and the number of left over squares.

Input Specification

1. The number of people making squares on the first day of the week, a, where a is a
positive integer
2. The number of new people making squares each day, b, where b is a positive number
value. (This value may be a decimal. If there are three new people every two days, this
can be represented by 1.5 people per day)
2

Output Specification

Output the result using the format below:
X blanket squares will be made this week!
You will be able to make Y blankets and start next week with Z squares.

Output Sample

Below are some sample outputs of running the program. Note that these samples are NOT a
comprehensive test. You should test your program with different data than is shown here based
on the specifications given above.

In the sample run below, for clarity and ease of reading, the user input is given in italics while
the program output is in bold. (Note: When you actually run your program no bold or italics
should appear at all. These are simply used in this description for clarityβs sake.)

Sample Run #1
How many people are knitting blanket squares at the beginning of the week?
1
How many new people are knitting blanket squares each day?
.5
17 blanket squares will be made this week!
You will be able to make 0 blankets and start next week with 17 squares.

Sample Run #2
How many people are knitting blanket squares at the beginning of the week?
3
How many new people are knitting blanket squares each day?
2
6561 blanket squares will be made this week!
You will be able to make 109 blankets and start next week with 21 squares.

Deliverables

One source files β knit2.c β is to be submitted over WebCourses.

Restrictions

Although you may use other compilers, your program must compile and run using Code::Blocks.
course number, section number, assignment title, and date. Also, make sure you include
comments throughout your code describing the major steps in solving the problem.