Answered step by step
Verified Expert Solution
Question
1 Approved Answer
answer all in C++ please COMP160 Programming Assignment 1 Submit the source code of your CH+ programs, only the .cpp files, using the Blackboard system.
answer all in C++ please
COMP160 Programming Assignment 1 Submit the source code of your CH+ programs, only the .cpp files, using the Blackboard system. Uplon all epp files as one submission. 1. [25 points] Modify the following C++ program so that the equations are written in correct C++ format. \#include using namespace std; int main() ( double a=0.5,b=2,0,c=3.0,d=7.0; double p1 =3.141592653589793 i b=1c2+a d=(a+b)(ab) c=a1+b1+d1 a=ad12.75b b=34a3 d=2ab+b24ac c=d1cos(ab) cout a=nanb=nbe endl; cout /0="ak=dm=+dend1; return 0 ; When run, the correct answer is: a=1.91369c=62.4262b=29.3565d=0.0149378 Below is a sample C+ program that reads a number from the keyboard and then displays it on the screen. Use this template to write the following programs. Example program showing simple input and output. */ Hinclude Enter a number >; If display prompt cin >> myVar; If get a number from the keyboard cout "The number is " myVar endl; If display the number retum 0 ; 3 2. [25 points] Write a program that reads in the length of an edge of a tetnhedron and displays its volume, which can be computed from the equation: volume=62edge3 Example: For a tetrahedron whose edge is 4.0, the area is 7.54247 3. [25 points] Write a program that converts liters to gallons. There are 3.78541 liters in a gallon. Input the number of liters and display the number of gallons. Example: For an input of 10.0 liters, the answer is 2.64172 gallons. 4. [25 points] Write a program that calculates the total resistance across two resistors in parallel. The total resistance can be calculated by TotalResistance=R11+R211 where R1 and R2 are the resistance of the two individual resistork Your program will need two variables for the individual resistors and will have to read both values. Example- For resistors of 10 and 25 ohms, the total resistance is 7.14286 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