by CodeChum Admin
Manipulating values from a series of numbers is fun, but let's try exploring the use of loops a little more.
How about printing out each digit of a number starting from its rightmost digit, going to its leftmost digit?
Instructions:
Input
A line containing an integer.
214
Output
Multiple lines containing an integer.
4
1
2
Instructions:
Instructions
Input
A line containing an integer.
10
Output
Multiple lines containing an integer.
9
7
5
3
1
Create enum for departments in an university – FINANCE, NETWORKS, EXAMINATION, are all departments of a university. Use the department enum in employee class. Traversed the department enum and prints the ordinal values. Enhanced enum with a new private instance variable deptCode holding the department code, a getter method for deptCode named getDeptCode(), and a constructor which accepts the department code at the time of enum creation
Create a simple library management system with the classes library,admin ,user,librarian,books,issue.
use instance methods such as getters, setters and constructors, for a library management system, your class should have functionality listed below:
a. add_new_book
b. book_details
c. issue_books
d. issued_books
e. return_books
Create a program using a console application name "DragonKiller". The program should ask the user to enter his/her name and surname. Create a method name RemoveSpace() to remove space between the name and the surname entered by the user. Count the number of characters within the newly created string (nameSurname). The total number of characters (Name and Surname) should be used as the size of your arrayDragon (type integer). Populate your arrayDragon with a series of odd random numbers between 10 and 50. Display all arrayDragon elements and their corresponding indexes before executing. The insertionSort method allows the user to enter a value from the arrayDragon element to search for and be removed (Killed). • Loop through the array until you find the value (Use the binarySearch to locate the value with in your array) and kill that value from the arrayDragon. By replacing the value findDragon with a Zero (0) • Print out arrayDragon with the killed element.
Design a program using a console application in java NetBeans, named studentMarksReport that will print the final result obtained by a student with the weighting of each module. Make use of a class named Student that contains variables to store the student number, test result, assignment result and exam. Create a constructor that accepts the student number, test result, assignment result and the exam result as parameters and create get methods for the variables (UseJOptionePane to get variable from the user). Create a subclass called Student_Report that extends the Student class. The Student_Report overrides all getter methods and the constructor from Students. Write code for the print_report method which calculates each assessment weighting as follows:
test =25% weighting
assignment=25%weighting
exam=50%weighting
1) Create a public class named: Employee that would get the firstname and lastname of each
employee from the keyboard/user
2) Create three objects: prog, adm and lib, for programmer, admin and librarian respectively to
access the properties in Employee class.
3) Create EmployeeSalary as parent interface to store basic_sal, housing_all and
transport_all. The values for these three items are fixed for all Employee and has abstract
function calculateSalary.
4) Create three sub classes namely: programmer, admin and librarian to store bonus,
overtime and total salary for each employee
5) Each of the constructor in (4) should inherit the properties of Employee(using the super
keyword) and implement the EmployeeSalary interface.
6) Hide the properties from the parent class Employee using encapsulation principle.
7) Use getters and setters to make the properties in Employee visible and accessible to other classes: programmer, admin and
librarian.
1) Create a public class named: Employee that would get the firstname and lastname of each
employee from the keyboard/user
2) Create three objects: prog, adm and lib, for programmer, admin and librarian respectively to
access the properties in Employee class.
3) Create EmployeeSalary as parent interface to store basic_sal, housing_all and
transport_all. The values for these three items are fixed for all Employee and has abstract
function calculateSalary.
4) Create three sub classes namely: programmer, admin and librarian to store bonus,
overtime and total salary for each employee
5) Each of the constructor in (4) should inherit the properties of Employee(using the super
keyword) and implement the EmployeeSalary interface.
6) Hide the properties from the parent class Employee using encapsulation principle.
7) Use getters and setters to make the properties in Employee visible and accessible to other
Write a program that declares and initializes an array of 7 integers. The program uses these static methods to perform different operations on the array:
void printArray(int[] arr) – takes the array as parameter and prints the array in horizontal order
int sumOfArray(int[] arr) – takes the array as parameter and returns the sum of the array
int getHighest(int[] arr) – takes the array as parameter and returns the highest value in the array
int resetArray(int[] arr) – takes the array as parameter and resets the value of each element to 0
Sample output:
Here’s the array:
3 1 3 2 1 9 1
Sum: 20
Highest: 9
Here’s the array:
0 0 0 0 0 0 0