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

  Identify the elements of the business model

Identify the elements of the Business Model that cloud computing as a new opportunity could transform and describe the Business Concept, that outlines the vision of this future business model,

  Data warehouse vs data mining

Please write a  paper for me on Data warehouse vs Data mining (8pages APA format)

  Create a program that functions as simple boolean calculator

Create a program that functions as a simple boolean calculator for 32-bit integers. It should display a menu that asks the user to make a selection from the following list.

  More registers appears to be a good thing

More registers appears to be a good thing, in terms of reducing the total number of memory accesses a program might require. Using the arithmetic expression S = (A+B)-(C+D)

  Draw an rea diagram-data modeling and database design

Data modeling and database design,  Draw an REA Diagram,  Draw an REA diagram for Sparky’s revenue cycle only. Be sure to include cardinalities. State any assumptions you had to make.

  Which five google technologies

1. Which five Google technologies would you like to research for your Final Case Studies?

  Network security and the internet

The general area of network security is obviously of enormous corporate and national importance. And there's no doubt that intrusion detection and prevention is a principal concern. Lately there have been a number of concerted security attacks on ..

  Show that among any group of positive integer

Let d be a positive integer.  Show that among any group of d+ 1 (not essentially consecutive) positive integer there are at least two with the similar reminder when they are divided by d.

  All firms can increase the volume of goods

All firms can increase the volume of goods or services sold by cutting prices. But the volume (quantity) of goods or services a firm sells differs from a firm's revenues (price times quantity). Select your firm or a firm not previously discussed. Wha..

  How do we read a numeric value using joptionpane method

How do we read a numeric value using JOptionPane method

  Why computer literacy has become fourth fundamental skill

Explain whether today, computer literacy (knowledge of how to properly use computer and its software applications) has become fourth basic skill.

  Examine the impact to the it support personnel

Be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides; citations and references must follow APA or school-specific format. Check with your professor for any additional instructions.

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