Provide a program to print the area of a rectangle

Publish By: Admin,
Last Updated: 16-Oct-23
Price: $120

Question: Java provide a program to print the area of a rectangle by creating a class named `Area` having two methods. First method named as `setDim` takes length and breadth of rectangle as parameters and the second method named as `getArea` returns the area of the rectangle. Length and breadth of rectangle are entered through keyboard.

Java provide a program to print the area and perimeter of a triangle having sides of 3, 4 and 5 units by creating a class named `Triangle` by using parameters in its constructor.

in Java Print the sum, difference and product of two double numbers provided by the user by creating a class named `Complex` with separate methods for each operation.

Java providea program by creating an `Employee` class having the following methods and print the final salary. 1 - `getInfo()` which takes the salary, number of hours of work per day of employee as parameter 2 - `AddSal()` which adds $10 to salary of the employee if it is less than $500. 3 - `AddWork()` which adds $5 to salary of employee if the number of hours of work per day is more than 6 hours.
5) Java provide a class called Player according to the specifications below.

• The Player class should contain the following instance variables

i. numHeads which stores the number of heads that are flipped

ii. numTails which stores the number of tails that are flipped

iii. playerName which stores the name of the player

• The Player class should contain the following constructor and methods:

i. A constructor that takes a String parameter to initialize playerName, and initializes numHeads and numTails to 0.

ii. A mutator method called flip that "flips a coin" by randomly generating either a 0 (heads) or a 1 (tails). It should then update either numHeads or numTails depending on what is flipped.

iii. An accessor method called getNumFlips that returns the total number of coin flips.