CS 160 - Programming Concepts and Applications

Summer II 2018 - Lab 2A - Math Equations

Quick Links: Canvas | John Cabot | Piazza | zyBooks

|   Home |  Contact |  Syllabus |  Assignments |  Schedule |  Resources   |

This lab is due by Friday, July 6, 2018, 11:59 PM.


Pair Programming



For this lab, you can work with a partner to practice pair programming and proper programming design.

Below are a list of equations provided by previous students. You and your partner will implement two of these equations.

# Major Equation Formula
1 Chemistry Ideal Gas Law Ideal Gas Law
2 Civil Engineering Average Acceleration Average Acceleration
3 Electrical Engineering Ohm's Law Ohms Law
4 Engineering Physics Newton's Law of Universal Gravitational Newton's Law of Universal Gravitational
5 Math Distance Distance
6 Math Volume Sphere Volume of a Sphere
7 Mechanical Engineering Deflection Deflection
8 Mechanical Engineering Heat Transfer Heat Transfer
9 Mechanical Engineering Stress Stress
10 Mining Shear Stress Shear Stress
11 Physics Coulomb's Law Coulombs Law

For each equation, you must:
  • Define the appropriate variables that are needed giving them the proper data type, a proper identifier, and a sensible initial value
  • Declare constants as needed
  • You must prompt the user to enter all non-constant values for the equations
  • Calculate the right hand side of the equation solving for the left hand side
  • Print out the final computed value of the equation
  • And as always, be sure to be providing helpful output to the user so the user provides the correct values and knows what is being returned

Now before you get started doing any coding, take out a piece of paper and write out the pseudocode to solve this task. Once you have your pseudocode, determine who is going to drive first and get to coding! We will switch drivers every 5 minutes so listen for the cue to switch positions.

At the end of this lab, your program output should look similar to below:

Enter the acceleration: 4.33
Enter the mass: 9.3
The force is: 40.269
Enter the width: 4
Enter the height: 2
The area is: 8


Lab Submission



You will submit your solution to this lab with the rest of Set2. Detailed instructions for doing this are posted in Assignment 2.


This lab is due by Friday, July 6, 2018, 11:59 PM.

Last Updated: 07/05/18 16:21


Valid HTML 4.01 Strict Valid CSS! Level Triple-A conformance, W3C WAI Web Content Accessibility Guidelines 2.0