Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write in C++ for a beginner program to understand (in simplist form) Write a pro

ID: 668206 • Letter: W

Question

Write in C++ for a beginner program to understand (in simplist form)

Write a program that prompts the user to input five decimal numbers. The program should then add the five decimal numbers, convert the sum to the nearest integer, and print the result.

Perform an analysis and design for this program. Write the code. Compile and test it

2.Cindy uses the services of a brokerage firm to buy and sell stocks. The firm charges 1.5% service charges on the total amount for each transaction, buy or sell. When Cindy sells stocks, she would like to know if she gained or lost on a particular investment. Write a program that allows Cindy to input the number of shares sold, the purchase price of each share, and the selling price of each share. The program outputs the amount invested, the total service charges, amount gained or lost, and the amount received after selling the stock.

Perform an analysis and design for this problem. Write the code, compile and test it.

Explanation / Answer

#include<iostream>
#include <cmath>
using namespace std;
int main()
{
double array[5];
double sum = 0;
for(int i = 0; i < 5; i++)
{
cout<<"Enter "<<i+1<<" number: ";
cin>>array[i];
sum += array[i];
}
sum = sum+0.5;
cout<<(int)sum;
system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote