This was the chapter 11 assignment 1(instructions are belowthis assignment)
Write a programthat converts a number entered inRomannumerals to decimal. Your programshould consisit ofa "class", say, romanType. An
object oftype romanType should do the following:
a. Store the number as a romannumeral.
b. Convert and store the number into decimal.
c. Print the number as a romannumeralor decimalas requested byuser.
the decimalvalues ofthe romannumerals are:
M=1000, D=500, C=100, L=50, X=10, V=5, I=1.
d. Test your programusingthe followingRomannumerals:MCXIV, CCCLIX, MDCLXVI
myhomework is the following:
Re-create the programyouwrote for Chapter 11 ProgrammingExcercise 1 to use a header file to store the class specifications (as showninthe
examples inthe text). Whencompleted, youwillbasicallybe turningina second copyofthe assignment, but you'llbe turningin2 files; the CPP
file, and a header file (.hextension) that stores the class details.
the folowingis myprogram.
#include <iostream>
#include <cmath>
usingnamespace std;
class romanType // class
{
void roman();
int convert();
void print();
void get();
int M, D, C, L, X, V, I;
char romanNumeral;
};
int main()
{
char romanNumeral;
cout << "Please enter the Romannumerals youwould like to to be converted:";
cin>> romanNumeral;
system("pause");
return0;
}
void romanType::roman()
{
M = 1000;
D= 500;
C = 100;
L= 50;
X= 10;
V= 5;
I = 1;
}
int romanType::convert()
{
if(romanNumeral= M)
{
cout << "1000";
}
else if(romanNumeral= D)
{
cout << "500";
}
else if(romanNumeral= C)
{
cout << "100";
}
else if(romanNumeral= L)
{
cout << "50";
}
else if(romanNumeral= X)
{
cout << "10";
}
else if(romanNumeral= V)
{
cout << "5";
}
else if(romanNumeral= I)
{
cout << "1";
}
returnromanNumeral;
}
void romanType::print()
{
cout << romanNumeral<< endl;
}
void romanType::get()
{
}

More Related Content

PDF
This was the chapter 11 assignment 1(instructions are below this assignment) ...
PDF
Lesson7 incdecoperators
PDF
Mcs 011 ignou question paper c language
PPTX
Function BPK2
PDF
Functions
DOCX
© Copyright 2013 by Pearson Education, Inc. All Rights Res.docx
PPT
ROMAN EMPIRE
PPT
Roman_Numerals_CC.ppt and conversion from figures to roman numerals
This was the chapter 11 assignment 1(instructions are below this assignment) ...
Lesson7 incdecoperators
Mcs 011 ignou question paper c language
Function BPK2
Functions
© Copyright 2013 by Pearson Education, Inc. All Rights Res.docx
ROMAN EMPIRE
Roman_Numerals_CC.ppt and conversion from figures to roman numerals

Recently uploaded (20)

PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI .pdf
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PPTX
Module on health assessment of CHN. pptx
PDF
My India Quiz Book_20210205121199924.pdf
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PDF
Hazard Identification & Risk Assessment .pdf
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Empowerment Technology for Senior High School Guide
PDF
semiconductor packaging in vlsi design fab
PDF
Complications of Minimal Access-Surgery.pdf
PDF
International_Financial_Reporting_Standa.pdf
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PDF
advance database management system book.pdf
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
Environmental Education MCQ BD2EE - Share Source.pdf
PPTX
What’s under the hood: Parsing standardized learning content for AI
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
AI-driven educational solutions for real-life interventions in the Philippine...
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI .pdf
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
Module on health assessment of CHN. pptx
My India Quiz Book_20210205121199924.pdf
Core Concepts of Personalized Learning and Virtual Learning Environments
Hazard Identification & Risk Assessment .pdf
Cambridge-Practice-Tests-for-IELTS-12.docx
What if we spent less time fighting change, and more time building what’s rig...
Empowerment Technology for Senior High School Guide
semiconductor packaging in vlsi design fab
Complications of Minimal Access-Surgery.pdf
International_Financial_Reporting_Standa.pdf
Uderstanding digital marketing and marketing stratergie for engaging the digi...
advance database management system book.pdf
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
Environmental Education MCQ BD2EE - Share Source.pdf
What’s under the hood: Parsing standardized learning content for AI
Ad
Ad

This was the chapter 11 assignment 1(instructions are below this assignment) Write a program that c

  • 1. This was the chapter 11 assignment 1(instructions are belowthis assignment) Write a programthat converts a number entered inRomannumerals to decimal. Your programshould consisit ofa "class", say, romanType. An object oftype romanType should do the following: a. Store the number as a romannumeral. b. Convert and store the number into decimal. c. Print the number as a romannumeralor decimalas requested byuser. the decimalvalues ofthe romannumerals are: M=1000, D=500, C=100, L=50, X=10, V=5, I=1. d. Test your programusingthe followingRomannumerals:MCXIV, CCCLIX, MDCLXVI myhomework is the following: Re-create the programyouwrote for Chapter 11 ProgrammingExcercise 1 to use a header file to store the class specifications (as showninthe examples inthe text). Whencompleted, youwillbasicallybe turningina second copyofthe assignment, but you'llbe turningin2 files; the CPP file, and a header file (.hextension) that stores the class details. the folowingis myprogram. #include <iostream> #include <cmath> usingnamespace std; class romanType // class { void roman(); int convert(); void print(); void get(); int M, D, C, L, X, V, I; char romanNumeral; }; int main() { char romanNumeral; cout << "Please enter the Romannumerals youwould like to to be converted:"; cin>> romanNumeral; system("pause"); return0; } void romanType::roman() { M = 1000; D= 500; C = 100; L= 50; X= 10; V= 5; I = 1; } int romanType::convert() { if(romanNumeral= M)
  • 2. { cout << "1000"; } else if(romanNumeral= D) { cout << "500"; } else if(romanNumeral= C) { cout << "100"; } else if(romanNumeral= L) { cout << "50"; } else if(romanNumeral= X) { cout << "10"; } else if(romanNumeral= V) { cout << "5"; } else if(romanNumeral= I) { cout << "1"; } returnromanNumeral; } void romanType::print() { cout << romanNumeral<< endl; } void romanType::get() { }