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

Hello, i need help with this C++ problem, it needs to be compiled in GNU C++ com

ID: 3851813 • Letter: H

Question

Hello, i need help with this C++ problem, it needs to be compiled in GNU C++ compiler.

In this assignment you will modify the program that you wrote for the previous assignment (Lab 1) and read in the values for seller and price from a file using the fstream library and format the output using the iomanip library Variables seller (seller's name: string), price (price of the house: double), cost (cost to sell the house, 696. double), commission (commission on the sale, 1 .5%: double) input (input file: ifstream) Input Realtor2.txt Name of seller, price of house (from file Realtor2.txt) Format of Realtor2.txt: example Garcia 100000 Output (note spacing) This program calculates the cost to sell a home and the commission paid to an individual sales agent. Seller's Cost Agent's Commission Home Owner Price of Home Garcia Step 1: Output descriptive messages cout >> variable_n; Step 4: Calculate cost/commission variable = expression;

Explanation / Answer

#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>

using namespace std;

int main() {
   string seller;
   double price;
   double cost;
   double commission;
  
   ifstream input;

   cout << "This program calculates the cost to sell a home and the commission paid to an individual sales agent. Home Owner"<< setw(16) <<"Price of Home"<< setw(22) <<"Seller's Cost"<< setw(21) <<"Agent's Commission ";

   input.open("Realtor2.txt");

   input >> seller >> price;

   cost = price * 6 / 100;
   commission = price * 1.5 / 100;

   cout << setw(10) << left << seller << right <<fixed << setprecision(2) << setfill('*') << setw(16) << price << setw(22) << cost << setw(21) << commission;

}

Pleae chk the answer.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote