Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions