Display the contents of both arrays on the screen

Assignment Help Basic Computer Science
Reference no: EM131079449

have a trouble with (f) of "RationalAssignment",sorting. My code isTestRational.java
RationalAssignment:

1. Make a class Rational to provide at least following methos and constructors:
Rational r1= new Rational (3,5);
Rational r2= new Rational (4,7);
Rational r3=r1.add(r2);
// also sub,mult,divide methods
Other that four operations you should provid methos that you think is useful for user of your class.

2. Write a JFrame or JApplet (file name: TestRational.java) that performs the following tasks:
a) Define two arrays of size 10. Each element in the array references to a Rational object that you wrote in Problem 1 above.
Rational a[], b[];
a = new Rational[10];
b = new Rational[10];

c) Display the contents of both arrays on the screen using JTextArea.b) Initialize the arrays in Question a) by creating random Rational numbers. Do this by generating two random numbers between 1 and 9 for each Rational and using the numbers as the numerator and denominator. Denominator should be greater than Numerator. You should generate random numbers with Math.random.

d) Add a Scrollbar to JTextArea for scrolling up or down.

e) For each public method in Rational class, create a corresponding JButton object. When the user clicks on a button, the actionPerformed listener should execute the corresponding Rational method for all the elements in the two arrays and store the results in a new array. You should then display the result array in the JTextArea using the setText method. For example, if the user hits the add button you should loop through all the elements in arrays and execute:
c[i] = a[i].add(b[i]);

f) If the user hits the sort button, uses the JTextArea method append to append the results of sorting.

Attachment:- 1603115_1_TestRational.zip

Reference no: EM131079449

Questions Cloud

Find a complementary or competing company in same industry : What are the security or control issuesthat should be addressed as part of the technology selection process for Kirby's business?
Long run costs for blockbuster : What were the long run costs for Blockbuster and the divisible inputs? Who were their competitors?
Ratio of income to capital in two countries : 1. What is the ratio of income to capital in these two countries? 2. What is the saving rate in country Z? 3. What is the growth rate of capital per worker in country A?
Forensic significance of the condition known as cadaveric : I need help with these questions: What are the objectives of death investigation and why they are important?
Display the contents of both arrays on the screen : If the user hits the sort button, uses the JTextArea method append to append the results of sorting.
Indicate audit procedures that should have brought the item : For each of the above events or transactions, indicate the audit procedures that should have brought the item to the attention of the auditor and the form of disclosure in the financial statements including the reasons for such disclosure.
Role of economics in health care : Describe why it is important for health policymakers to be familiar with basic economic concepts? Explain role of economics in health care? Examine the use of economic models to help forecast the impact of policy on health care delivery?
Company zero-tolerance harassment policy : Another student asked this same homework assignment previously on this site and I cannot use any of the material (powerpoint slides) that a tutor helped her with. I need something orginal and that has not been turned into any other colleges since ..
Prepare a report for mr tomas gurny the it manager at hbzs : CIS5308 Management of IT Services. For the purpose of this assignment, assume the role of a consultant who have been hired by HBZS to contribute to a review of IT Service Management at HBZS. You will prepare a report for Mr Tomáš Gurny, the IT Mana..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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