Create a program that will String input. Based on the number of inputs,
the USER will decide what shape it is circle,rectangle,square and triangle.
(1 input – circle, 2 inputs – square or rectangle, 3 inputs - triangle).
The program will then display the shape type, details, perimeter and area.
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Circle
Radius:15
Perimeter:94.2
Area:706.5
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Rectangle
Length:24
Width:12
Perimeter:72.0
Area:288.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Square
Side:12
Perimeter:48.0
Area:144.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar 9 15 12
Type:Triangle
Sides:9, 15, 12
Perimeter:36.0
Area:54.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar 9 15 12 8
Invalid input
class:
-TestShape
-Shape
-Circle
-Rectangle
-Square
T-riangle
Write a program that takes a String
through Command Line argument and display the length of
the string. Also display the string into uppercase and check whether it is a palindrome or not.
Write a class to represent dates (i.e., day/month/year). Add methods that should perform operations such as determining the number of days between two dates, add two dates, determining the number of months between two dates and determining the day of the week that a particular date falls on. Write a test class to confirm that your date class works.
Create a program that will String input. Based on the number of inputs, the user will decide what shape it is. (1 input – circle, 2 inputs – square or rectangle, 3 inputs - triangle). The program will then display the shape type, details, perimeter and area.
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Circle
Radius:15
Perimeter:94.2
Area:706.5
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Rectagle
Length:24
Width:12
Perimeter:72.0
Area:288.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar15
Type:Square
Side:12
Perimeter:48.0
Area:144.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar 9 15 12
Type:Triangle
Sides:9, 15, 12
Perimeter:36.0
Area:54.0
Justines-MacBook-Pro:classes Justine$ java-jar Shape.jar 9 15 12 8
Invalid input
Julio Cesar Chavez Mark VII is an interplanetary space boxer, who currently holds the championship belts for various weight categories on many different planets within our solar system. However, it is often difficult for him to recall what his "target weight" needs to be on earth to make the weight class on other planets. Write a Java program to help him keep track of this. Create a Weight class in which you will have your main method. Perform all the inputs, calculations, and outputs in the main method.
It should ask him what his earth weight is, and to enter a number for the planet he wants to fight on. It should then compute his weight on the destination planet based on the table below:
#
Planet
Relative gravity
1. Venus: 0.78
2. Mars: 0.39
3. Jupiter: 2.65
4. Saturn: 1.17
5. Uranus: 1.05
6.Neptune: 1.23
information for the following planets:
1. Venus 2. Mars 3. Jupiter
4. Saturn 5. Uranus 6. Neptune
Which planet are you visiting?
Create a class Animal and its derived classes Cat, Dog and Duck. The class should include the following methods: Sound( ), Eat( ), Drink( ). Create the objects of all these classes, fill them in an array and randomly select an object from the array and displaying the following information about each object.
A. Name.
B. Breed.
Write a java program using arrays that accepts the width and length of a rectangle and computes both its area and perimeter.
Write a Java method to find the smallest number among three numbers.
Test Data:
Input the first number: 25
Input the Second number: 37
Input the third number: 29
Write a Java method to compute the future investment value at a given interest rate for a specified number of years.
Sample data (Monthly compounded) and Output:
Input the investment amount: 1000
Input the rate of interest: 10
Input number of years: 5
Seoul Garden Sdn Bhd serves a wide range of seafood selections such as tasty crabs, fresh prawns, chicken fillets & many more for steamboat and grill. This buffet restaurant serves up 150+ choices of fresh seafood, fruits, and cold & hot beverages.
Age 6-12 years old, the price is RM 11 while age 13 and above years old, the price was RM 25.
Seoul Garden Sdn Bhd also gives an appreciation for the member cardholder with 6% off from the total price. The above price excludes government tax of RM 5.60.
Write an application that accepts the customer’s age and member status (member or non-member) by using a JOptionPane procedure and prints out the total price.