Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/** Converts Roman numerals to decimal value */ import java.util.Scanner; public class RomanNumerals { public static void main(String[] args) { Scanner in = new Scanner(I

/** Converts Roman numerals to decimal value */ import java.util.Scanner;

public class RomanNumerals { public static void main(String[] args) { Scanner in = new Scanner("I C X D M L");

char romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 1") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 100") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 10") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 500") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 1000") ; romanNumeral = in.next().charAt(0); System.out.println("Value: " + valueOf(romanNumeral) + " Expected: 50") ; } /** Gives the value of the Roman numerals I X L C D M @param numeral a single Roman numeral @return the integer value of numeral */ //-----------Start below here. To do: approximate lines of code = 14 // write a static method valueOf with the appropriate parameters and return type. // must be an M //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

PACT was a set of principles originally designed for:

Answered: 1 week ago

Question

1.The difference between climate and weather?

Answered: 1 week ago

Question

1. What is Fog ?

Answered: 1 week ago

Question

How water vapour forms ?

Answered: 1 week ago

Question

What is Entrepreneur?

Answered: 1 week ago

Question

Which period is known as the chalolithic age ?

Answered: 1 week ago