Derive the class extendedroman from the class roman

Assignment Help JAVA Programming
Reference no: EM13940600

The programming assignment for this module is programming exercise #7 on pages 861 and 862, with the following modifications.

-For part 'a' the source code for class Roman is attached to this assignment. You do not have to include the method decimalToRoman as you modify this class. Also, class Roman is not used in your test program.

-In part 'b' be sure to throw exceptions for the conditions specified when subtracting and dividing. The Roman's grasp of math was very limited (why else would they have developed such an awkward system for recording numbers?) and never considered negative numbers. Basically all they did was count things.

-While your program will only use the ExtendedRoman class you must submit three files for this assignment: Roman, ExtendedRoman, and your test program.

Source code for class Roman: Roman.java (original source code attached)

Here is the assignment as written in the book:

a.) Modify the definition of the class Roman so that the data members are declared as protected. Also incluse the method decimalToRoman, which converts the decimal number (the decimal number must be a positive integer) to an equivalent Roman numeral format. Write the definition of the method decimalToRoman. Your definition of the class Roman must contain the method toString, which returns the string containing the number in Roman format. For simplicity, we assume that only the letter I can appear in front of another letter and that it appears only in front of the letters V and X. For example, 4 is represented as IV, 9 is represented as IX, 39 is represented as XXXIX, and 49 is represented as XXXXIX. Also, 40 is represented as XXXX, 190 is represented as CLXXXX, so on.

b.) Derive the class ExtendedRoman from the class Roman to do the following. In the class ExtendedRoman, include the methods add, subtract, multiply, and divide so that arithmetic operations can be performed on Roman numerals.
To add (subtract, multiply, or divide) Roman numerals, add (subtract, multiply, or divide, respectively) their decimal representations and then convert the result to the Roman numeral format. For subtraction, if the first number is smaller than the second number, throw the exception, "Because the first number is smaller than the second, the numbers cannot be subtracted." Similarly, or division, the numerator must be larger than the denominator.

c.) Write the definition of the methods add, subtract, multiply, and divide as described in part B. Also, your definition of the class ExtendedRoman must contain the method toString that returns the string containing the number in Roman format.

d.) Write a program to test various operations on your class ExtendedRoman.

Attachment:- Roman.zip

Reference no: EM13940600

Questions Cloud

Create a class for services offered by a hair-styling salon. : The Curl Up and Dye Salon offers a variety of salon services for its customers. Jane Fields, the owner, has contracted to have you write a program that allows reports to be output, sorted by each type of service offered. Table below shows the vari..
Should federal government control over state law enforcement : Is federalism the answer, or should the federal government have control over the state law enforcement operations? Consider the Arizona lawsuit against the federal government regarding the law enforcement activities surrounding people in this coun..
Considering production for a special order : The Ellis Machine Tool Company is considering production for a special order for 10,000pieces at $0.65 apiece, which is below the regular price. The current operating level, which is below full capacity of 70,000 pieces, shows the operating result..
Prepare an income statement for the year : Prepare journal entries for the transactions above. Use good form for the journal entries. Prepare a trial balance at December 31 based on the journal entries above. Prepare an income statement for the year
Derive the class extendedroman from the class roman : For part 'a' the source code for class Roman is attached to this assignment. You do not have to include the method decimalToRoman as you modify this class. Also, class Roman is not used in your test program.
Combination of monetary and non-monetary rewards : A Holistic rewards package should include a combination of monetary and non-monetary rewards
Required resources found on vuws : Based on the Learning Portfolio assessment, write a 1000 word academic essay addressing the question below. Students should include six (6) to ten (10) scholarly references which include at least three (3) of the Five Required Resources found on v..
Prepare a report that indicates differences in audit report : Prepare a report that indicates the affect of the above cited differences in your audit report that will be widely used by stakeholders and potential stakeholders in the United States
Direct labor costs were incurred : Raw materials were issued for use in production.Direct labor costs were incurred.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd