3d

Advanced Placement

Computer Science Lab

 

 

 

 

 

Converter & String Tokenizer

 

Introduction

 

String tokenizer class can be used to breakdown and parse a string into component parts in order to perform and operation.  In this assignment you will write a program to accept a strig and perform a calculation and output the result.

 

 

 

 

 

Programming Assignment

 

Write a program that will convert roman numeral characters into Arabic numbers or vice versa. For example, if the user enters "xiv", you are to print out the number "14". If the user decides to put in an Arabic number like "109", print out "cix". When the user first starts your program, print 3 blank lines and present a menu. Give him a choice of 1) converting numbers from roman numeral to Arabic, 2) converting numbers from Arabic to roman numeral, or 3) quitting. Depending of the user's choice, perform the proper operation. When the user is through converting one type of number to another, be sure to present the menu for the person again. Do this until the user is ready to quit. Structure your program so that you have a method that converts Arabic numbers to roman and another that converts roman numerals to Arabic.  Use the following test data, cix = 109, mcmxlvii = 1947.