Answered step by step
Verified Expert Solution
Question
1 Approved Answer
BIT 1 4 0 0 Assignment 3 Summer 2 0 2 4 Let s see if we can do something similar to A 2 so
BIT Assignment Summer
Lets see if we can do something similar to A so everyone feels more comfortable with C programming
and algorithmic thinking. In this assignment you will:
Begin thinking about code reuse and identifying why functions can be useful.
Demonstrate the ability to write syntactically and logically correct C code for math operations.
Compose logically sound and unambiguous pseudocode for a real world calculation problem.
Part : Pseudocode
Submit a pseudocode solution for finding concern students in BIT if all students and their grades
were written in an excel spreadsheet ie a big grid of students and their grades On each row of the
spreadsheet is a students information. Columns in the table will be student name, assignment grades
assignment grades and lab attendance grades listed as truefalse For each subroutine,
just refer to it and define later.
A student is considered a concern student if they didnt attend at least of the labs so far and didnt
pass both assignment and assignment
Make sure you define any subroutines you write.
Pseudocode will be loosely defined as any algorithmic and nonambiguous set of instructions that are
performed one after the other. Therefore, flow charts and stepbystep instructions would both count.
If some part of the task is ambiguous either, ask or clearly state the assumptions you are making.
If you write your instructions on paper, take clear easytoread photos and put them all into a single pdf
file. If you write the pseudocode on a computer I dont recommend this without a digital pen, but it is
your choice then make a pdf of your work. Submit this pdf file to Brightspace.
Part : Variables and basic functions
This assignment is still attempting to ease you in to programming in C
If you programmed before; dont worry. The problems are about to be more challenging. In the
meantime, you should solve these problems using reusable functions for a bit more of a challenge
experienced programmers ONLY If A was too hard, hopefully this will restore some confidence.
Make a new project with a single cpp file titled Acpp where is your first
initial and last name. Put a main method in the cpp file.
In the main method, make a new constant const double variable named MYPI MYPI should be
equal to
Make two variables double data type named radius and diameter. Set the diameter to and radius is
always diameter
To test your code, you can modify the value of radius and make sure your code works for
different values.
Set the value back to before submitting your work but write comments stating the values you
tested and the results you got.
Area of a Circle:
Make a variable areaCircle a double and calculate the area of a circle with the given radius the
variable above Recall that the area of a circle is pi r but there is no need for a square function. You
just need for multiply.
Use printf to write a message about the area of the circle.
Volume of a Cylinder:
When calculating the volume of a cylinder, we will make the height of the cylinder equal to the
diameter.
You should test that the cylinder volume calculation works for multiple different diameters.
Make a variable volumeCyl double that stores the volume of a cylinder.
Use printf to write a message about the volume of the cylinder.
Volume of a cylinder intro to functions: Notice how much nicer it would be if we just wrote the area of
a circle code just once?
Incorrect Volume
Try to calculate the volume of a sphere with integers only: pi r r r
To make sure each number is an integer and NOT a double or float, you can put int in front of each
noninteger. Something like:
int sphereVol int MYPI intradius int radius int radius;
Next, calculate sphereVol as the correct calculation but cast the final number to be an int. That would
look something like:
int sphereVolint MYPI;
Calculate sphereVol which CORRECTLY calculates the volume of the sphere. SphereVol should be a
double.
Finally, using printf statements to output the values and meaningful messages of sphereVol,
sphereVol and sphereVol
Printf is a function that lets you output messages to the screen. It has a format like this:
printfSome message to output i myVal;
Lets say myVal was the message Some message to output would appear in the output window.
Recall that f is for floats and doubles while i and d are for integer digits. Please see the lab TAs for
help if you are confused. You may also look at assignment for help.
Also note:
in the text message makes a new line. Therefore
printfSome message to output
i
;
outputs
Some message to output
Calculating Cube Volume
Finally calculate the volume of a cube with dimensions diameter x diameter x diameter where
diameter is the diameter variable you made at the start of t
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started