(Using Inheritance)
Create a parent class named “Parent”, with a method that displays “I am a Parent Class”.
Also create a subclass that named “Child” that has a method that prints “I am a Child Class”.
Now create a class with Main Method, where you will:
Create an object for each class (1 for “Parent” and 1 for “Child”)
Call the method of “Child” class by using the Child object
Call the method of “Parent” class by object of the “Parent” class
1.Write a Java program that calculates and prints the monthly pay for an employee. The net pay is calculated after taking the following deductions:
Witholding 15%
SSS contribution 3.63%
Medicare 1.25%
Pag-IBIG PHP 100.00
2.Initialize two (2) variables to hold the employee name and the gross pay (amount before deductions). See sample output below:
Employee Name: Jess Diaz
Gross Pay: 25000.0
Deductions Amount
Witholding Tax 3750.0
SSS Contributions: 907.5
Medicare: 312.5
Pagibig Contribution: 100.0
Net Pay: 19930.0
Instructions:
Create a variable that accepts a positive integer.
Create an empty list. Then, using loops, add string values to your list using the input() function. The number of string values to be added are dependent on the inputted value on the first inputted integer.
Create another variable that accepts a non-negative integer. The number must only range from 0 until the value of the first inputted integer.
Using your understanding on accessing list elements, access and print out the list element having the index position of the second inputted integer.
Input
The first line contains an integer n which is the size of the array.
The next n lines contains a string on each.
The last line contains an integer which is the index to be accessed and printed.
6
Learning
Programming
made
easy
with
Cody!
5
Output
A line containing a string.
Cody!
Modify the given codes to remove the compilation errors. (2 items x 5 points)
1.
public interface Carnivore {
int pieces = 10;
public static void eatGrass();
public int chew() {
return 13;
}
}
2.
interface Haswings {
public int getNumberOfWings();
}
abstract class Insect implements HasWings {
abstract int getNumberOfLegs();
}
public class Dragonfly extends Insect {
int getNumberOfLegs() {
return 6;
}
}
Create a Hierarchy chart that will accurately represent the information in the scenario below: “A main programme calls three modules: getDetails(), calculateFees(), and register(). The calculateFees() module calls a module called courses() and a module called courseCost(). The register() module calls a module called printProof().”
By making use of pseudocode, show the programming statements that will
accept two values from a user. These two values should be added together, and
the result displayed on the screen
On the form, create two combo boxes, to allow a user to select between three
different printers and years. When a user has selected a printer and year and clicked
the submit button, display the amount of ink cartridges used for that year. Use the
following table for the printers and yearly cartridges used:
2018 2019 2020
HP Deskjesk 650 10 35 20
Epson K750 15 22 12
Canon Z100 30 31 33
Q.1.2 You are also required to create a menu system which will allow the user to exit the
application under the file menu. Under the tool’s menu, allow the form submission
and an option to display the yearly ink cartridges used for each printer. The layout
of the form is left to your discretion. Marks will be allocated to the presentation and
effectiveness of the layout, but the following layout is displayed for your
convenience.
Write a Java GUI application that will keep track of a company’s products. The application must
contain the product id, product name and the product price.
Q.3.1 On the form, create three text fields to capture the product details and a non‐
editable text area to display the product details. Create a submit button that
when clicked will save the product details to a Products.txt file. Also include a
search button that will allow a user to search for a product based on the product
id.
Q.3.2 Create a sequential file (products.txt) that contains data for the following fields:
The product id
The product name
The product price
application and use a Two dimensional array that will store five information technology
8 OfonQ, with the average amount of
stered for each course
Your program must:
Contain a two dimensional array to contain three student registration figures for five
different information technolory courses and a single array to contain the course
Males
COURSE
REGISTRATION I REGISTRATION >
I REGISTRATION 3
Programming 101
50
10
50
Web Dev 101
10
50
20
Databases 101
10
70
Logic 101
Management 101
30
50
Q.2.2 Calculate and print the average of the course registration figures for each IT course
Q.2.3 Determine if the IT course will be run or not. If the average registration figures of the IT
course is greater than or equal to 70 then the IT course will run.
0.2.4 Print out each course name with the average registration and if the course will run
Contain a single arrav to contain the tollowine tive Enelish words and a
TWO
dimensional array to store the following Dutch, French and Italian translated words
ENGLISH WORD
DUTCH WORD
VI FRENCH WORD
ITALIAN WORD
hemel
ciel
cielo
run
rennen
courir
carrare
study
studie
mUSC
muzipk
musE
musica
dog
hond
chipn
cane
18. 10. 20
Q.2.2 Print out each English word with the translated Dutch, French and Italian word.