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

Assignment Overview This assignment involves coding and testing of a program tha

ID: 3591771 • Letter: A

Question

Assignment Overview This assignment involves coding and testing of a program that reads input files, and uses functions to calculate statistical information about the input data Assignment Background Unable to find a tenure-track job in Academia, and unwilling to make slave-wages as an adjunct, you turn to jobs in industry. You find yourself employed at RobCo, a multinational corporation producing dozens of different products for different markets all over the United States. The suits in marketing have assigned you your first big project, identifying trends in product sales, and the effectiveness of advertising. You must identify which ads for what products are performing besit, and identify, for each product, the ad that gives the best ROI, or Return On Investment. When your boss's boss is finally done flapping his mouth and leaves your cubicle, you sit dumbfounded for a moment. You can't believe it. That's it? This is the big project? Obviously, this joker can't operate a calculator, so he hired you to do it. You can't believe he makes ten times your salary. You have a degree in Computer Science, for Pete's sake! Well, the cat won't feed itself, and you need the money. You crunch on a Mentat, and boot your terminal to hunt down the project specifications In order to calculate per-ad ROl, and identify the best-performing ads, you are given a file containing a list of ads for products, and for each ad, the product, the number of ads run, the cost per ad, the number of sales associated with this ad, sale price for the product, and the per- product production cost While you're reading, you notice a post-it note stuck to the underside of your terminal keyboara It's dusty, and crumbs are stuck to the adhesive. There's a username and password, a directory and a filename: proj05.py. Intrigued, you log in with the password, open up the file, and find a program skeleton, with some partly implemented functions in it to calculate ROI, and some comments that imply that it's for this exact project. Huzzah! But where did this come from? The only clue as to the author are the initials, RCK. Strange. There must have been a developer before you, assigned to this same project. You wonder what happened to them. Why did thejy quit an easy project half-way? Maybe your boss knows. You keep reading For each product, you must identify the ad with the most sales, and you must also identify which ad has the best ROl. They might be different! Example Given the marketing data for the following products and ads:

Explanation / Answer

A similar code but without taking input from file but asking the user to input the data.

#include <iostream>

#include<iostream>

#include<conio.h>

#include<string.h>

#include<fstream.h>

#include<ctype.h>

#include<iomanip.h>

#include<conio.h>

#include<stdio.h>

class product

{

int no_plays_issues_spots;

char name_ad[50];

char type_whether_play_issue_spot;

int number_of_ads;

int no_sales;

int price_per_plays_issues_spots;

float sale_price;

float product_cost;

float ad_price;

public:

void revenue(int no_sales,float sale_price); //function to get data from user

float cost_of_goods_sold(int number_of_ads,float ad_price, int no_sales, float product_cost); //function to show data on screen

float calculate_ROI(int number_of_ads, float ad_price, int no_sales, float sale_price, float product_cost); //function to get new data from user

void create_ad();

}; //class ends here

void product::create_ad()

{

cout << " Enter The No of ads .";

cin >> number_of_ads;

for (int i = 0;i <= number_of_ads;i++)

{

cout << " Enter The Name of The ad : ";

gets(name_ad);

cout << " Enter Type : ";

cin >> type_whether_play_issue_spot;

type_whether_play_issue_spot = toupper(type);

cout << " Enter The price per play/issue/spot ";

cin >> price_per_plays_issues_spots;

cout << " Enter Number of sales";

cin >> no_sales;

cout << " Enter sale_price";

cin >> sale_price;

cout << " Enter production cost";

cin >> product_cost;

}

void product::revenue(int no_sales,float sale_price)

{

float revenue_amt;

revenue_amt = no_sales*sale_price;

cout >> revenue_amt;

}

void product ::cost_of_goods(int number_of_ads, float ad_price, int no_sales, float product_cost)

{

float cost_of_goods,tot_ad_price;

tot_ad_price = number_of_ads*ad_price;

cost_of_goods = tot_ad_price*sale_price;

cout >> cost_of_goods;

}

void product::calculate_ROI(int number_of_ads, float ad_price, int no_sales, float sale_price, float product_cost)

{

float ROI;

float X;

X = revenue_amt - cost_of_goods_sold;

ROI = X / cost_of_goods_sold;

}

int main()

{

cout << " 01. cREATE AD";

create_ad();

cout << " 02. CALCULATE REVENUE";

revenue();

cout << " 03. CALCULATE cost_of_goods_sold";

cost_of_goods();

cout << " 03. calculate_ROI";

calculate_ROI();

}

void write_product()

{

product pc;

ofstream outFile;

outFile.open("product.dat", ios::binary | ios::app);

pc.create_ad();

outFile.write((char *)&ac, sizeof(account));

outFile.close();

}

// function to display all ads n products

void display_all()

{

product pc;

ifstream inFile;

inFile.open("product.dat", ios::binary);

if (!inFile)

{

cout << "File could not be open !! Press any Key...";

return;

}

cout << " product information ";

cout << "==================================================== ";

while (inFile.read((char *)&pc, sizeof(product)))

{

pc.report();

}

inFile.close();

}

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