Implementation of a simple java class

Assignment Help JAVA Programming
Reference no: EM13920483

The purpose of this lab is to gain experience in the design and implementation of a simple Java class.  You will create a class definition and write a simple main method that will test the methods of your class to ensure they work as expected.

The required task is to create a class definition for the concept of a Roman numeral.  When a Roman numeral object is declared, it should hold a representation of the Roman numeral (e.g., MMXV) and provide the following functionality:

  • A constructor that initializes the Roman numeral to the value supplied as the parameter to the constructor in Roman numeral format
  • A constructor that initializes the Roman numeral to the value supplied as the parameter to the constructor in decimal format
  • A method that returns the value of the Roman numeral
  • A method that returns the decimal equivalent of the value of the Roman numeral

Note: a Roman numeral object is only allowed to permanently store the Roman numeral representation of the number (i.e., adding an int member for the decimal equivalent is not allowed).

Your test program must create Roman numeral objects and enable the user to sufficiently test the class methods for correctness.  I/O can be console based - e.g., you may want to prompt the user for a Roman numeral, create a Roman numeral object and then output the numeral in both Roman numeral and decimal format.

The extended task is to add functionality to the class to add Roman numerals.  Note to get any credit for this method this addition must be done using the Roman numeral format of the numbers, not by converting them to decimal values and adding those.  Your test code should be extended to allow the user to exercise the add function as many times as desired.

As a reminder, these are the decimal values of the Roman numeral "digits":

M    1000
D    500
C    100
L    50
X    10
V    5
I    1

Reference no: EM13920483

Questions Cloud

Find p-value. : You need to hand in individual work. You may talk with each other about the problems. However, everything in the assignment must be your own work.
Discuss quasi-experimental designs : Jackson (2012), even-numbered chapter exercises, p 360. Describe the advantages and disadvantages of quasi-experiments? What is the fundamental weakness of a quasi-experimental design? Why is it a weakness? Does its weakness always matter?
Description of the features of your product or service : A detailed description of the features of your product or service including how it solves the needs of your target market. A description of how your marketing efforts will change with each phase in the product life cycle
Anonymous reporting of accusations of fraud : ___________ requires that firms in the private sector provide procedures for anonymous reporting of accusations of fraud.
Implementation of a simple java class : The purpose of this lab is to gain experience in the design and implementation of a simple Java class.  You will create a class definition and write a simple main method that will test the methods of your class to ensure they work as expected.
Digital marketing-sales promotion-direct marketing : Write a 6,000- to 7,000-word paper that integrates your previous Learning Team assignments into a final Marketing Plan. In addition to your previous papers, include the following:
Cost of goods sold : Calculate the total dollar amount of cost of goods sold and total dollar amount of ending inventory for October assuming FIFO is used.Calculate total dollar amount of cost of goods sold and total dollar amount of ending inventory for October assuming..
Elements of message syntax on a sequence diagram : Question 3: Explain elements of message syntax on a sequence diagram. Question 4: Describe the risk factors associated with database design
Calculate profit for the year if full cost price is charged : Calculate the profit for the year if a full cost price is charged. Calculate the profit-maximising price. Assume in both (a) and (b) that 50,000 units of timm are produced regardless of sales volume.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Arrays and control structures problem

While working with Java, one should become familiar with the term called array. An array is a category that holds more than one value at one time, a list of various items that belong to a certain category or bucket. Similar to an excel spreadsheet..

  A fault is fundamentally a deviation from expected behavior

write a 200- to 300-word short-answer response to the following a fault is basically a deviation from expected

  Create a function that multiplies numeric matrices

Create a function that multiplies numeric matrices on an element-by-element basis.

  What is a java archive

What type of output does the javadoc command generate and how do you view the output and what is a Java archive?

  Discuss factors that affect sorting in sediment

Discuss factors that affect sorting in sediment. How could one tell the latitude at which a sediment was originally deposited? Compare and contrast phosphate and manganese nodules.

  The api for this class ispublic void poweronnbsp sets the

the api for this class ispublic void poweronnbsp sets the machine ready to serve the selected ice creampublic void

  Using a linked implementation of graph write a method that

using a linked implementation of graph write a method that takes two nodes as input and returns true if joining an edge

  Program that uses a library database of books

Write a Java program that uses a library database of books and patron data, as described in Exercise R22.2. Patrons should be able to check out and return books.

  Illustrate the power of java inheritance and polymorphism

Illustrate the power of Java inheritance and polymorphism. Your response to this question is in multiple parts. You will submit your answers as specified at the end of this question.

  Java program to compare two variables if they are equal

Write down program which will ask user to initialize two character arrays, program must compare two variables if they are equal.

  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.

  Statistics list program

You will also modify your program to accept input from an input file and print a report to an output file. These files are to be named by the user at runtime.

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