Question: Java programming. Please include comments so I can learn what you did/fixed. Best answer will be rated thumbs up! import java.util.Scanner; public class RomanNumeralCalculator {

Java programming. Please include comments so I can learn what you did/fixed. Best answer will be rated thumbs up!

Java programming. Please include comments so I can learn what you did/fixed.

import java.util.Scanner;

public class RomanNumeralCalculator { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num;

do { System.out.println("Please enter an integer from 1 to 5999. Enter a negative number to exit."); System.out.print("-> "); num = input.nextInt();

if (num

if (num

while (num >= 1000) { roman += "M"; num -= 1000; }

switch (num % 10) { case 0: case 1: case 2: case 3: break; case 4: roman += "CD"; num -= 400; break; case 5: case 6: case 7: case 8: roman += "D"; num -= 500; break; case 9: roman += "CM"; num -= 900; break; default: System.err.println("There is a problem with the tens place."); }

while (num >= 100) { roman += "C"; num -= 100; } switch (num / 10 % 10) { case 0: case 1: case 2: case 3: break; case 4: roman += "XL"; num -= 40; break; case 5: case 6: case 7: case 8: roman += "L"; num -= 50; break; case 9: roman += "CX"; num -= 90; break; default: System.err.println("There is a problem with the tens place."); }

while (num >= 10) { roman += "X"; num -= 10; }

switch (num) { case 0: case 1: case 2: case 3: break; case 4: roman += "IV"; num -= 4; break; case 5: case 6: case 7: case 8: roman += "v"; num -= 5; break; case 9: roman += "IX"; num -= 9; break;

default: System.err.println("There is a problem with the units place."); }

while (num > 0) { roman += "I"; num--; }

System.out.println(roman); } } while (num > 5999); } }

Along with this lab statement is a solution' to the Roman numeral calculator. Create a project and import this code file into that project. Identify and fix all logic errors to make the code function properly. You may use a debugger and / or add print statements. You are not allowed to modify the structure of the code, although you may add a single line. Otherwise, you may modify expressions in the code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!