RomanNumerals Solution

$30.00

Description

File Name:

H:\CPSC1150\Lab7\RomanNumerals.java

Purpose

To convert a positive integer to Roman Numerals

.

Input

A number between 1 and 3999

Output

The number in Romal Numerals

Program Logic (Pseudocode)

Algorithm Roman Numerals

Start

(main method)

  1. Ask for an int number
  2. Check the number and make sure it is between 1 and 3999 (if statement)
  3. Take number to converter method (returns a string)
  4. Display number in roman numerals

(converter method)

  1. Divide number by 1000 and take it to firstnumber method

  2. Divide number by 100 and take it’s % 10 to the secondnumber method

  3. Divide number by 10 and take it’s % 10 to the secondnumber method

  4. Take the number’s % 10 to the firstnumber method

  5. Add the strings in order and return

(firstnumber method)

  1. Create a switch statement in string for the thousand’s category
  2. Return the correct string

(secondnumber method)

  1. Create a switch statement in string for the hundred’s category
  2. Return the correct string

(thirdnumber method)

  1. Create a switch statement in string for the ten’s category
  2. Return the correct string

(fourthnumber method)

  1. Create a switch statement in string for one’s category
  2. Return the correct string