Input Note:
You must test object’s capability by using the provided driver. Then develop a new driver to process the Roman inventory list. Note you can add any new methods / friends functions to the extRomanType to complete the second part you deem necessary.

The file will be in the follow format.
[Name] [Inventory] [Total Cost]

[Name] = The name of the item
[Inventory] = The number of item on hand in roman numbers
[Total Cost] =The total cost of the item listed in denarii

Example of the inventory list:
Grains VII XXI
Birds X ILX
Slaves XXI XCL

Process the file until you reach the end of file.

Output Note:
The Output will display the item and there average unit cost ( divide the cost by the number on hand). You must overload the division symbol in the derived roman class. Also the division should always round to the nearest whole number. Write the unit cost in both roman and decimal.

General Form

[Item Name] [Unit cost in Decimal ] [Unit Cost in Roman]

Grains 3 III
Birds 6 VI
Slaves 7 VII
Wine 11 XI
Total number of items in the inventory: 49 IL

//this is the cpp file. i need to make a header file for this and i have no idea how and what to use. please help

#include <iostream>
#include <string>
#include "extRoman.h"

using namespace std;

int main()
	extRoman num1("XXXIV");
	extRoman num2("XV");
	extRoman num3;
	cout<<"Num1 = "<<num1<<endl;
	cout<<"Num2 = "<<num2<<endl;
	cout<<"Num1 + Num2 = "<<num1+num2<<endl;
	cout<<"Num1 * Num2 = "<<num1*num2<<endl;

	cout<<"Enter two numbers in Roman format";

	cout<<"Num1 = "<<num1<<endl;
	cout<<"Num2 = "<<num2<<endl;

	num3 = num2 * num1;
	cout<<"Num3 = "<<num3<<endl;


	return 0;


Edited by WaltP: Added CODE Tags

6 Years
Discussion Span
Last Post by daviddoria

First, please use code tags.

Instead of writing a "header", I think you mean you need to write the "class" called extRoman. at the very least you have a bunch of operator overloading to do (--, ++, +, <<, *). Sounds like you'll also need some functions for averages etc.

Give it a shot and maybe someone will help you, but just posting your assignment isn't going to get you anywhere.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.