by CodeChum Admin
Remember that time when we've tried identifying the largest digit among the given integer? Well, let's take it to the next level, and figure out the same thing on arrays/lists!
Let's do this one more time!
Instructions:
Input
The first line contains the size of the array/list.
The next lines contains an integer on each.
5
5
34
3
23
10Output
A line containing an integer.
34A company dealing with marketing wants to manage the data of its employees. Each employee has a full name, unique employee number (2019000 to 2019999) and the number of hours he worked and her hourly wage (price).
(Using Encapsulation)
Create a class named 'Student' with 2 instance variables (both set as private)
The 2 variables are: String variable 'name' and integer variable 'roll_no'.
Create a get and set Method for each variable.
Also create a class with Main Method, where you will:
Create an object of the class Student
Allow the user to enter a value for the name and roll_no and accept the values by using
the set Method of each variable
Display the content of the object by using the get Method of each variable
(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.