CSCI 261 - Programming Concepts

Spring 2019 - Lab 2B - Pretty Math Equations

Quick Links: Canvas | Mines | Piazza | zyBooks

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

This lab is due by Tuesday, January 29, 2019, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab.


Make it look pretty!



At the end of Lab2A, our program output looked something like:

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

Which works, but we'd like to be more precise and make values easier to read. Specifically, we want to always display three decimal places and align the decimal points when outputting the results. Using the appropriate I/O manipulators, modify your program from Lab2A to match the following template:

Enter the acceleration: 4.33
Enter the mass: 9.3

Enter the width: 4
Enter the height: 2

Equation #01...Newton's 2nd Law (Physics): 40.269
Equation #12...............Area (Math)   :  8.000

Where the #nn displayed corresponds to the number of the equation from the table. Then fill the space to right align the equation names followed by the major the equation relates to. The colons and decimal points should be aligned with three decimal places following. You'll need to use a combination of I/O manipulators and turn settings on/off to accomplish this task.


Lab Submission



You will submit your solution to this lab with the second homework assignment. Detailed instructions for doing this are posted in Assignment 2.



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 Tuesday, January 29, 2019, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab.

Last Updated: 08/24/18 23:13


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