Given a positive number, create an array with that number as the size and populate it with the items/names provided. Additionally, the program should print out the longest name in the array.
Sample Run1
3
Apple
Banana
Kiwi
Output1: Banana is the longest name
Write a class that has three overloaded methods for calculating the areas of the following geometric shapes:
• Circle
• Rectangle
• Cylinder
Create a source code of this Output.
Output:
My name is Kevin Limbo
The sum is: 7
The difference is: 3
The product is: 10
The quotient is: 2.5
2nd year & Augustine SY 2021-2022
Given a positive number, create an array with that number as the size and populate it with the items/names provided. Additionally, the program should print out the longest name in the array.
Sample Run1
3
Apple
Banana
Kiwi
Output1: Banana is the longest name
As a build-up from the previous question, consider 3 possible scenarios of input: A character, number, or word. Your program should then do the following:
Sample Run 1 Sample Run 3
Enter a character, number or word : c Enter a character, number or word : 7
Output 1 : C is not a vowel Output 3 : 7 is a prime number
Enter a character, number or word: programming
Output 2: Programming is not a palindrome
Using the provided recording and your knowledge from programming 1. Create a program in java that takes in an input from the user and checks whether it’s a number or a word. In case a number is entered the program should print the number to the power 3 and if a word is entered your program should split that word into 2.
Sample Run 1
Enter a number or word: 7
Output 1:
7 to the power 3= 343
Sample Run 2
Enter a number or word: NAMIBIA
Output 2:
The word split in half is : NAMI and BIA
PROGRAM 3 – Times tables
You must write a small application in JAVA that will read in a positive integer and then display the times tables for that number, from 1 to 12.
Your program must
1. Read in the integer as input.
2. Calculate and display the complete times tables up to 12 for that integer.
3. If a zero or any number less is entered, an error message must be displayed and the user must be allowed to input another value.
PROGRAM 2 – Maths Calculator
Write a small application in JAVA that reads in two integers, and then asks the user to type in a character to indicate what calculation must be done with the two numbers, viz:
A to add
S to subtract
M to multiply
D to divide
Display the result of the calculation.
The output of sample runs of the program is given below (the text in bold was typed by the user).
Please use the SAME wording/messages/labels as shown.
Sample execution run 1 Sample execution run 2
Enter the first number: 27
Enter the second number: 9
What would you like to do?
A to add
S to subtract
M to multiply
D to divide
Enter choice: s
27 minus 9 is 18.
Enter the first number: 15
Enter the second number: 0
What would you like to do?
A to add
S to subtract
M to multiply
D to divide
Enter choice: D
**Error** Cannot divide by zero.
PROGRAM 1 – Shopper Calculator
You must write a small application in JAVA that can assist a shopper by calculating the total price of the items that he or she wants to buy and displaying a tillslip-like list of the products, their prices and the total due.
Your program must
1. Read the name and price of five items as input.
2. Calculate the total price for the items.
3. Display all the item names and prices.
4. Display the total due for all items.
Design a Car model class under package packages with the following attributes:
Member Field Name
licenceNumber
Type
String
String
Double
Model
currentMileage engine Size
Integer
Mark all the attributes as private & Create default & parameterized constructors
Design another class as Main under package packages, where you need to implement logic as follows
Declare an array as Car with size N where N is to be accepted from user Take N Car's information from user and store them in specified array Call sortCarlist method from Main class to get all cars information sorted based on Model name and display then within Main class after returning back
from the specified method From Main class car array need to pass within sortCarLast method which return sorted car array and then display all car information on console.
Design sortCarlist method in Car clast, as follows: will take a car array and retam car array
it will sort array based on model value given in each car as its information