You found an exciting summer job for five weeks. It pays Php150.00 per hour. Suppose that the total tax you pay on your summer job income is 14%. After receiving your pay, you spend 10% of your net income to buy new clothes and other accessories for the next school year and 1% to buy school supplies. After buying clothes and school supplies, you use 25% of the remaining money to buy savings bonds. For each peso you spend to buy savings bonds, your parents spend Php 0.50 to buy additional savings bonds for you. Write a program that prompts the user to enter the number of hours you worked each week.
In this task, you are being asked to write a loop in Java.
Write a program that uses while loops to perform the following steps:
a) Prompt the user to input two integers: startingNum and endingNum (startingNum must be
less than endingNum).
b) Output all even numbers between startingNum and endingNum.
c) Output the sum of all even numbers between startingNum and endingNum.
d) Output the numbers and their squares between startingNum and endingNum.
e) Output the sum of the square of the odd numbers between startingNum and endingNum.
1. Create a program called WhileLoops.java. All loops will be written in this file.
2. Create appropriate variables and assign values using a Scanner object.
3. Correctly display appropriate messages.
Problem: Make a program that will accept 2 numbers and a choice of operation (1 = Display Sum, 2 = Display Difference, 3 = Display Product, 4 = Display Quotient, and 5 = Display All). if the choice input is not from 1 to 5, reaccept an input again. Display the selected option by the user.
Example input and output:
Enter number: 5
Enter number: 2
[1] Display Sum
[2] Display Difference
[3] Display Product
[4] Display Quotient
[5] Display All
Input choice: -1
[1] Display Sum
[2] Display Difference
[3] Display Product
[4] Display Quotient
[5] Display All
Input choice: 10
[1] Display Sum
[2] Display Difference
[3] Display Product
[4] Display Quotient
[5] Display All
Input choice: 5
Sum : 7
Difference: 3
Product: 10
Quotient: 2
In java
Create a java program to test if a password is valid or not. For the password to be acceptable it must satisfy the following rules:
- At least one (1) vowel.
- No two (2) consecutive same letter, except "ee" or "oo".
- No three (3) consecutive vowels.
- Must not be more than 20 characters and no uppercase letter.
Input
Enter one or more possible password per line, the word "end" ends the input.
Output
Display the entered password followed by either "is Valid" or "is Invalid"
Sample Input
bee
books
pc
beautiful
ambitious
end
Sample Output
bee is Valid
books is Valid
pc is Invalid
beautiful is Invalid
ambitious is Invalid
Create a program that will String input. Based on the number of inputs, the program 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
Write a program in Java to display a diamond pattern of asterisks.
Expected Output :
*
***
*****
*******
*********
***********
*************
***********
*********
*******
*****
***
*
Consider the following scenario A student has a name, which consists of a given name and a family name, and a student IID. Each student is uniquely identified by his/her student ID. A course has a subject and a course ID. For each course, we want to record the number of students taking that course and the type of equipment being used for the course. A course is uniquely identified by its course ID. A student can be enrolled in an arbitrary number of courses, and an arbitrary number of students can be enrolled in a course. For each course in which they are enrolled students receive a lab mark and an exam mark. A course cannot exist if there is no student enrolled in it. A school is distinguished by the honour's degree that it awards. We also want to record to which faculty a school belongs. A student is registered with at most one school, while a school can have an arbitrary number of students.
a. Identify the entities, attributes and relationships.
b. Show the identifier/s for each entity
What values are returned during the following series of stack operations, if
executed upon an initially empty stack? push(5), push(3), pop(), push(2), push(8), pop(),
pop(), push(9), push(1), pop(), push(7), push(6), pop(), pop(), push(4), pop(), pop().
create class calculation with an abstract method area().Create Rectangle and Triangle subclasses of calculation and find area of rectangle and triangle.
In the class LambdaExercise, create following static variables
1. countries of type List<String>
2. countryCapitals of type Map<String, String>