DOC PREVIEW
OSU CSE 1223 - PRO8A

This preview shows page 1 out of 3 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

package project08 Project08a java A program that converts decimal numbers to Roman numerals Used to practice breaking code up into methods author import java util Scanner public class Project08 public static void main String args Scanner Yi new Scanner System in String RomanNumeral int validnumber while true validnumber promptUserForNumber Yi if validnumber 0 break RomanNumeral convertNumberToNumeral validnumber System out println RomanNumeral Yi close private static int promptUserForNumber Scanner inScanner boolean run true int number 0 while run System out println Input a number between 1 and 3999 or 0 to quit number inScanner nextInt if number 3999 number 1 number 0 System out println You re not very good at listening to directions are you else run false return number private static String convertNumberToNumeral int number char one I char five V char ten X char fifty L char onehundred C char fivehundred D char onethousand M String str str convertDigitToNumeral number one five ten number 10 str convertDigitToNumeral number ten fifty onehundred str number 10 str convertDigitToNumeral number onehundred fivehundred onethousand str number 10 while number 0 str onethousand str number return str private static String convertDigitToNumeral int digit char one char five char ten String str if digit 9 digit 0 return Invalid Digit if digit 9 str ten digit 10 else if digit 4 str five digit 5 while digit 0 str one digit while digit 0 str one str digit return str


View Full Document

OSU CSE 1223 - PRO8A

Documents in this Course
PRO12A

PRO12A

3 pages

PRO11A

PRO11A

4 pages

PRO10A

PRO10A

3 pages

PRO9A

PRO9A

3 pages

PRO7A

PRO7A

2 pages

PRO6A

PRO6A

2 pages

PRO4A

PRO4A

3 pages

PRO3A

PRO3A

3 pages

CL13A

CL13A

2 pages

CL11B

CL11B

2 pages

CL11A

CL11A

2 pages

CL10A

CL10A

2 pages

CL5A

CL5A

2 pages

Load more
Download PRO8A
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view PRO8A and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view PRO8A and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?