Question

Ask the user to enter a year.
Using a switch statement, convert the year into Roman numerals.
Display the year as an integer, and as a Roman numeral, with a message, on the screen.

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.Scanner;

public class RomanNumerals {

public static void main(String[] args){
// initialize the scanner
Scanner inputScanner = new Scanner(System.in);

// prompt the user to input a year in arabic format
System.out.print("Please enter a year: ");

// get user input
String userInput = inputScanner.next();

// convert the user input to an integer
int userYear = Integer.parseInt(userInput);

// getting the thousands and removing them from the remaining
int thousands = userYear / 1000;
int remainingYears = userYear % 1000;

// getting the hundreds and removing them from the remaining
int hundreds = remainingYears / 100;
remainingYears = remainingYears % 100;...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Java Problems: Euclidean Distance and Arrays
Homework Solution
$20.00
Java
Programming
Computer Science
Coding
Euclidean Distance
Reversing an Array
String Values
Integer Values
Boolean Arrays
Input
Output
Square Root
Sum of Squares
Mathematics
Vectors
Rows
Columns
Java Programming: Arrays Of Marks & Circles
Homework Solution
$50.00
Java
Programming
Codes
Computer Science
Algorithms
Arrays
Marks
Circles
Geometry
Mathematics
Radius
Random Numbers
Boundaries
Statements
Loops
Variables
Points
Coordinates
Perimeters
Area
Multiplication Table in Java
Homework Solution
$40.00
Java
Programming
Codes
Algorithms
Computer Science
Statements
Variables
Loops
Rows
Columns
Input
Output
Integers
Strings
Multiplication
Tables
Operations
Conditions
Cylinder Containers in Java
Homework Solution
$25.00
Java
Programming
Codes
Algorithms
Computer Science
Statements
Variables
Loops
Input
Output
Integers
Strings
Geometry
Mathematics
Cylinder
Radius
Finance
Costs
Containers
Companies
Functions
Java Programming Assignment
Homework Solution
$40.00
Java Programming
Computer Science
Arrays
Dynamic Allocation
ArrayList
Constructor
Java Project For Consulting Company
Homework Solution
$50.00
Java
Programming
Computer Science
Consulting Company
Inventory
Interfaces
Products
Lookup
Classes
Libraries
Queries
Finance
Employees
Management
OOP
Function
Methods
Loops
Conditions
Get help from a qualified tutor
Live Chats