I want help to solve this problem in pascal:

In this problem you will design and implement a Roman numeral calculator. Most people are unaware that the subtractive Roman numeral notation commonly in use today (such as IV Meaning 4) was only rarely used during the time of the Roman Republic and Empire. For ease of calculation, the Romans most frequently used a purely additive notation in which a number was simply the sum of its digits (4 equals IIII in this notation).

Each number starts with the digit of highest value and ends with the one of smallest value. This is the notation we will use in this problem.

Your program will input two Roman numbers and an arithmetic operator and print out the result of the operation, also as a Roman number. The values of the Roman digits are as follows:

I 1

V 5

X 10

L 50

C 100

D 500

M 1000

Thus, the number MDCCCCLXXXVIIII represents 1989. The arithmetic operators that your program should recognize in the input are +, -, * and /. These should perform the Pascal operations of integer addition, subtraction, multiplication and division.

One way of approaching this problem is to convert the Roman numbers into integers, perform the required operation, and then convert the result back into Roman number for printing. The following might be a sample run of the program, for an interactive system.

Enter the first number:

MCCXXVI

The first number is 1226

Enter the second number:

LXVIIII

The second number is 69

Enter the desired arithmetic operation:

+

The sum of MCCXXVI and LXVIIII is MCCLXXXXV (1295)

Your program should use a good style, appropriate comments, meaningful identifiers, proper indentation and avoid side effects.

It should also check for errors in the input, such as illegal digits or arithmetic operators and take appropriate actions when these are found. You may also have the program check to be sure that the numbers are in purely additive forms digits are followed only by digits of the same or lower value.

And I have to do the problem with just this sections:Choice Statements, Loop Statements, Procedures and Functions,Subrange,Arrays,Enumarated types,TextFiles and Records.

It looks like you're new here. If you want to get involved, click one of these buttons!

- 140.8K All Categories
- 103.6K Programming Languages
- 6.4K Assembler Developer
- 401 Assembly Code Share
- 239 Getting started in assembly
- 4.6K x86 Assembly
- 1.9K Basic
- 97 Qbasic
- 39.9K C and C++
- 5.6K Beginner C/C++
- 330 C/C++ on Linux/Unix
- 450 C/C++ Windows API
- 522 C++ Builder
- 253 C++ Game Development
- 3.3K C++ MFC
- 103 C++.NET
- 404 Visual C++
- 2.9K C#
- 7.9K Delphi and Kylix
- 334 Advanced Delphi
- 360 Delphi beginners
- 4 Haskell
- 9.7K Java
- 56 Enterprise JavaBeans
- 1.3K Java Beginners
- 304 Java Server Pages
- 4.1K Pascal
- 1.3K Perl
- 11 Perl 6
- 2K PHP
- 546 Python
- 37 Ruby
- 4.4K VB.NET
- 258 Advanced VB.Net
- 1.6K VBA
- 20.8K Visual Basic
- 767 Access databases and VB
- 831 Advance Visual Basic
- 1.2K Beginner VB
- 2.6K Game programming
- 315 Console programming
- 90 DirectX Game dev
- 1 Minecraft
- 112 Newbie Game Programmers
- 2 Oculus Rift
- 9K Applications
- 1.8K Computer Graphics
- 279 3D Graphics
- 129 DirectX
- 125 OpenGL
- 740 Computer Hardware
- 9 Cooling & Overclocking
- 3.4K Database & SQL
- 1.1K Access
- 91 ADO Programming
- 288 MySQL
- 358 Oracle
- 440 SQL-Server
- 535 Electronics development
- 1.6K Matlab
- 628 Sound & Music
- 25 DirectSound
- 257 XML Development
- 3.3K Classifieds
- 199 Co-operative Projects
- 198 For sale
- 190 FreeLance Software City
- 1.9K Jobs Available
- 603 Jobs Wanted
- 209 Wanted
- 2.9K Microsoft .NET
- 1.8K ASP.NET
- 1.1K .NET General
- 22 .NET WEB-Services
- 129 .NET WinForms
- 14 .NET XML
- 50 ADO.NET
- 142 C# & VB.NET School Support
- 3.4K Miscellaneous
- 4 Join the Team
- 354 Comments on this site
- 69 Computer Emulators
- 2.1K General programming
- 187 New programming languages
- 621 Off topic board
- 200 Mobile & Wireless
- 72 Android
- 126 Palm Pilot
- 338 Multimedia
- 154 Demo programming
- 184 MP3 programming
- 0 Bash scripts
- 27 Cloud Computing
- 1 Witsbits Go Cloud
- 53 FreeBSD
- 1.7K LINUX programming
- 1 Awk scripting
- 332 Linux Support
- 0 Sed scripting
- 370 MS-DOS
- 0 Shell scripting
- 321 Windows CE & Pocket PC
- 4.1K Windows programming
- 177 COM/DCOM
- 61 Networking And Security
- 17 Windows 2003 Server
- 6 Windows Vista
- 176 Windows XP
- 939 Software Development
- 416 Algorithms
- 68 Object Orientation
- 24 RUP & UML
- 91 Project Management
- 95 Quality & Testing
- 268 Security
- 63 Evil Scripting
- 81 Hacking
- 7.7K WEB-Development
- 1.8K Active Server Pages
- 61 AJAX
- 4 Bootstrap Themes
- 55 CGI Development
- 28 ColdFusion
- 224 Flash development
- 1.4K HTML & WEB-Design
- 1.4K Internet Development
- 131 Mobile Internet & Messaging
- 211 Wireless development
- 2.2K JavaScript
- 37 JQuery
- 304 WEB Servers
- 153 Apache
- 79 IIS
- 150 WEB-Services / SOAP

## Comments

: I want help to solve this problem in pascal:

:

: In this problem you will design and implement a Roman numeral calculator. Most people are unaware that the subtractive Roman numeral notation commonly in use today (such as IV Meaning 4) was only rarely used during the time of the Roman Republic and Empire. For ease of calculation, the Romans most frequently used a purely additive notation in which a number was simply the sum of its digits (4 equals IIII in this notation).

: Each number starts with the digit of highest value and ends with the one of smallest value. This is the notation we will use in this problem.

:

: Your program will input two Roman numbers and an arithmetic operator and print out the result of the operation, also as a Roman number. The values of the Roman digits are as follows:

:

: I 1

: V 5

: X 10

: L 50

: C 100

: D 500

: M 1000

:

: Thus, the number MDCCCCLXXXVIIII represents 1989. The arithmetic operators that your program should recognize in the input are +, -, * and /. These should perform the Pascal operations of integer addition, subtraction, multiplication and division.

:

: One way of approaching this problem is to convert the Roman numbers into integers, perform the required operation, and then convert the result back into Roman number for printing. The following might be a sample run of the program, for an interactive system.

:

: Enter the first number:

: MCCXXVI

: The first number is 1226

: Enter the second number:

: LXVIIII

: The second number is 69

: Enter the desired arithmetic operation:

: +

: The sum of MCCXXVI and LXVIIII is MCCLXXXXV (1295)

:

: Your program should use a good style, appropriate comments, meaningful identifiers, proper indentation and avoid side effects.

:

: It should also check for errors in the input, such as illegal digits or arithmetic operators and take appropriate actions when these are found. You may also have the program check to be sure that the numbers are in purely additive forms – digits are followed only by digits of the same or lower value.

:

: And I have to do the problem with just this sections:Choice Statements, Loop Statements, Procedures and Functions,Subrange,Arrays,Enumarated types,TextFiles and Records.

:

:

The way it works is: you try to write some code and then post it back when you run into trouble. Someone might help you then. Simply copy/pasting from your syllabus into a message like this won't cut it.

: : I want help to solve this problem in pascal:

: :

: : In this problem you will design and implement a Roman numeral calculator. Most people are unaware that the subtractive Roman numeral notation commonly in use today (such as IV Meaning 4) was only rarely used during the time of the Roman Republic and Empire. For ease of calculation, the Romans most frequently used a purely additive notation in which a number was simply the sum of its digits (4 equals IIII in this notation).

: : Each number starts with the digit of highest value and ends with the one of smallest value. This is the notation we will use in this problem.

: :

: : Your program will input two Roman numbers and an arithmetic operator and print out the result of the operation, also as a Roman number. The values of the Roman digits are as follows:

: :

: : I 1

: : V 5

: : X 10

: : L 50

: : C 100

: : D 500

: : M 1000

: :

: : Thus, the number MDCCCCLXXXVIIII represents 1989. The arithmetic operators that your program should recognize in the input are +, -, * and /. These should perform the Pascal operations of integer addition, subtraction, multiplication and division.

: :

: : One way of approaching this problem is to convert the Roman numbers into integers, perform the required operation, and then convert the result back into Roman number for printing. The following might be a sample run of the program, for an interactive system.

: :

: : Enter the first number:

: : MCCXXVI

: : The first number is 1226

: : Enter the second number:

: : LXVIIII

: : The second number is 69

: : Enter the desired arithmetic operation:

: : +

: : The sum of MCCXXVI and LXVIIII is MCCLXXXXV (1295)

: :

: : Your program should use a good style, appropriate comments, meaningful identifiers, proper indentation and avoid side effects.

: :

: : It should also check for errors in the input, such as illegal digits or arithmetic operators and take appropriate actions when these are found. You may also have the program check to be sure that the numbers are in purely additive forms – digits are followed only by digits of the same or lower value.

: :

: : And I have to do the problem with just this sections:Choice Statements, Loop Statements, Procedures and Functions,Subrange,Arrays,Enumarated types,TextFiles and Records.

: :

: :

: The way it works is: you try to write some code and then post it back when you run into trouble. Someone might help you then. Simply copy/pasting from your syllabus into a message like this won't cut it.

:

One Example That I did Is like that but doesn't work(It Gives Type Mismatch):

PROGRAM Roman_Calculator;

TYPE

indexType = 1..7;

RomanNumberArray = array [indexType] of char;

RomansNumbers = (I,V,X,L,C,D,M);

VAR

RomansNu : RomansNumbers;

RomansNo : RomanNumberArray;

first,second,ao,sum : char; {ao = arithmetic operation}

realnumber : integer;

index : indexType;

Procedure Read_Romans_Numbers_to_Real;

BEGIN

For RomansNu := I TO M DO

begin

writeln('Enter The First Number: '); readln(first);

Case first Of

'I':begin realnumber := 1; end;

'V':begin realnumber := 5; end;

'X':begin realnumber := 10; end;

'L':begin realnumber := 50; end;

'C':begin realnumber := 100; end;

'D':begin realnumber := 500; end;

'M':begin realnumber := 1000; end

else writeln('Roman Numerals Are Just I,V,X,L,C,D,M');

writeln('The First Number is',realnumber);

write('Enter The Second Number:'); readln(second);

Case second Of

'I':begin realnumber := 1; end;

'V':begin realnumber := 5; end;

'X':begin realnumber := 10; end;

'L':begin realnumber := 50; end;

'C':begin realnumber := 100; end;

'D':begin realnumber := 500; end;

'M':begin realnumber := 1000; end

else writeln('Roman Numerals Are Just I,V,X,L,C,D,M');

end;

writeln('The Second Number is',realnumber);

end;

write('Enter The Arithmetic Operation:'); readln(ao);

Case ao of

'+': begin sum := 'first'+'second'; end;

'-': begin sum := 'first'-'second'; end;

'*': begin sum := 'first'*'second'; end;

'/': begin sum := 'first'/'second'; end

else writeln('The Arithmetic Operations are +,-,*,/.');

end;

write('The Sum Of ',first,'and',second,'is',sum);

End;

End;

: : : Hi

: : : I want help to solve this problem in pascal:

: : :

: : : In this problem you will design and implement a Roman numeral calculator. Most people are unaware that the subtractive Roman numeral notation commonly in use today (such as IV Meaning 4) was only rarely used during the time of the Roman Republic and Empire. For ease of calculation, the Romans most frequently used a purely additive notation in which a number was simply the sum of its digits (4 equals IIII in this notation).

: : : Each number starts with the digit of highest value and ends with the one of smallest value. This is the notation we will use in this problem.

: : :

: : : Your program will input two Roman numbers and an arithmetic operator and print out the result of the operation, also as a Roman number. The values of the Roman digits are as follows:

: : :

: : : I 1

: : : V 5

: : : X 10

: : : L 50

: : : C 100

: : : D 500

: : : M 1000

: : :

: : : Thus, the number MDCCCCLXXXVIIII represents 1989. The arithmetic operators that your program should recognize in the input are +, -, * and /. These should perform the Pascal operations of integer addition, subtraction, multiplication and division.

: : :

: : : One way of approaching this problem is to convert the Roman numbers into integers, perform the required operation, and then convert the result back into Roman number for printing. The following might be a sample run of the program, for an interactive system.

: : :

: : : Enter the first number:

: : : MCCXXVI

: : : The first number is 1226

: : : Enter the second number:

: : : LXVIIII

: : : The second number is 69

: : : Enter the desired arithmetic operation:

: : : +

: : : The sum of MCCXXVI and LXVIIII is MCCLXXXXV (1295)

: : :

: : : Your program should use a good style, appropriate comments, meaningful identifiers, proper indentation and avoid side effects.

: : :

: : : It should also check for errors in the input, such as illegal digits or arithmetic operators and take appropriate actions when these are found. You may also have the program check to be sure that the numbers are in purely additive forms – digits are followed only by digits of the same or lower value.

: : :

: : : And I have to do the problem with just this sections:Choice Statements, Loop Statements, Procedures and Functions,Subrange,Arrays,Enumarated types,TextFiles and Records.

: : :

: : :

: : The way it works is: you try to write some code and then post it back when you run into trouble. Someone might help you then. Simply copy/pasting from your syllabus into a message like this won't cut it.

: :

: One Example That I did Is like that but doesn't work(It Gives Type Mismatch):

: PROGRAM Roman_Calculator;

: TYPE

: indexType = 1..7;

: RomanNumberArray = array [indexType] of char;

: RomansNumbers = (I,V,X,L,C,D,M);

:

: VAR

: RomansNu : RomansNumbers;

: RomansNo : RomanNumberArray;

: first,second,ao,sum : char; {ao = arithmetic operation}

: realnumber : integer;

: index : indexType;

: Procedure Read_Romans_Numbers_to_Real;

: BEGIN

: For RomansNu := I TO M DO

: begin

: writeln('Enter The First Number: '); readln(first);

: Case first Of

: 'I':begin realnumber := 1; end;

: 'V':begin realnumber := 5; end;

: 'X':begin realnumber := 10; end;

: 'L':begin realnumber := 50; end;

: 'C':begin realnumber := 100; end;

: 'D':begin realnumber := 500; end;

: 'M':begin realnumber := 1000; end

: else writeln('Roman Numerals Are Just I,V,X,L,C,D,M');

:

: writeln('The First Number is',realnumber);

: write('Enter The Second Number:'); readln(second);

: Case second Of

: 'I':begin realnumber := 1; end;

: 'V':begin realnumber := 5; end;

: 'X':begin realnumber := 10; end;

: 'L':begin realnumber := 50; end;

: 'C':begin realnumber := 100; end;

: 'D':begin realnumber := 500; end;

: 'M':begin realnumber := 1000; end

: else writeln('Roman Numerals Are Just I,V,X,L,C,D,M');

: end;

: writeln('The Second Number is',realnumber);

: end;

: write('Enter The Arithmetic Operation:'); readln(ao);

: Case ao of

: '+': begin sum := 'first'+'second'; end;

: '-': begin sum := 'first'-'second'; end;

: '*': begin sum := 'first'*'second'; end;

: '/': begin sum := 'first'/'second'; end

: else writeln('The Arithmetic Operations are +,-,*,/.');

: end;

: write('The Sum Of ',first,'and',second,'is',sum);

: End;

: End;

:

:

:

It's because you're trying to do mathematical operations on strings and trying to assign the results to a variable of char type. You will want to do your math on realnumber, but it's getting assigned to twice. Try using realnumber1, and realnumber2 or something like that. Replace 'first' and 'second' in the [b]case ao[/b] block with those variables. The [b]begin..end[/b] pairs are not necessary in any of your case statements. I really don't see the need for the [b]for..to..do[/b]loop. Your case statements should handle it. Otherwise, a good try :-)