Question: public static void sort(String[] str) { I/design sorting algorithm here Section C - PROGRAMMING QUESTIONS (45 marks in total with 15 marks each) 1. Design
public static void sort(String[] str) { I/design sorting algorithm here Section C - PROGRAMMING QUESTIONS (45 marks in total with 15 marks each) 1. Design a class named Rectangle to represent a rectangle. The class contains: - Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. - A no-arg constructor that creates a default rectangle. - A constructor that creates a rectangle with the specified width and height. - A method named getArea(that returns the area of this rectangle. - A method named getPerimeter that returns the perimeter. Write a test program that creates two Rectangle objects - one with width 4 and height 40, and the other with width 3.5 and height 35.9. Display the width, height, area, and perimeter of each rectangle in this order. 2. Write a program called TestString, to read a string and a character from command-line. The program will count the number of occurrences of the character in the string, and display the results. Example run as following: > java TestString exampleStringanca > There are 2 a(s) appears in "exampleStringanc". 3. Write a program called MyEditor, on which there are three buttons: Save, Read, and Clear. When button Save is clicked, it should perform saving the text from the text area into a file called "test.txt", when Read clicked, it would read text from the file "test.txt", and display within the text area, and when Clear clicked, text within the text area would disappear. GUI show as below. My Editor Test Line 1 Line2 233 444
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
