Java | JSP | JSF Answers

Questions: 3 611

Answers by our Experts: 3 611

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Implement your own version of the stack data structure using java with OOPs principles mentioned functionalities: push, pop, peek, contains, size, center, sort reverse, iterator, traverse/print.

Use of similar data structures already present in the language/framework is not allowed.


Implement the java code with data structure supporting listed functionalities using object-oriented principles

.Hash Table

  • Insert
  • delete
  • contains
  • get value by key
  • size
  • iterator
  • traverse

Implement your own version of the linked list using java with mentioned functionalities: insert, insert at position, delete, delete at position, center, reverse, size, iterator, traverse/print.

Use of similar data structures already present in the language/framework is not allowed.


Suppose that score is an int variable. Consider the following if statements: if (score >= 90);


System.out.println("Discount = 10%");


a. What is the output if the value of score is 95? Justify your answer.


b. What is the output if the value of score is 85? Justify your answer.



Write a Java program that prompts the user to enter thier gender ( Female/ male) and day of the week ( Monday to Sunday). If you enter Monday, or Tuesday, or Wednesday or Thursday it should read "Hello sir, enjoy your day" or "Hello mam enjoy your day". But when entered Friday, or Saturday, or Sunday it should read "Hello sir enjoy your weekend" or "Hello mam enjoy your weekend "

Construct a simple purchasing program based on the Requirement Below.



Main.java should only contain the main method and a Reference of Purchase Object. Purchase.java should contain this fields & Methods:





Fields/Instance Variables



-itemName : String



-itemPrice : double



-itemQuantity : int



-amountDue :double





Methods



setItemName(String itemName) : void



setTotalCost(int quantity, double price) : void



getItemName(): String



getTotalCost(): double



readInput():void



writeOutput(): void





Note: The readinput() method will be used to accept user input through the Scanner class.



Simple output :


Enter the name of the Item you are Purchasing: Bag


Enter QTY and Price Separated by a space: 3 499.75


You are Purchasing 3 Bag(s) at 499.75 each.


Amount due is 1,499.25



A private String data field named patientName.

b) A private int data field named newID. This value will be automatically incremented with the creation of

each Appointement object. The initial value of newID is 1.

c) A private constant (final) int data field named APPOINTEMENT_ID.

d) A private int data field named dayhe value represents the day of the week from 1 to 5, (1 for Monday, 2

for Tuesday, and so on till Friday).

e) A private int data field named hour. Accepted values are 8, 9, 10, …14

f) A constructor that creates a new appointment with specific patient Name given as argument. Then, the

appointment will be immediately assigned a APPOINTEMENT_ID according to newID.

g) The accessor (getter) methods for patientName and APPOINTEMENT_ID.

h) The accessor and mutator (setter) methods for the day and hour fields. Note that if the day value is not in

[1,5] then the field is set 0. Also, if the hour is not in [8,14], the field value is set to 0.


  1. Create (4) java classes. Name them RunEmployee, Employee, FullTimeEmployee, PartTimeEmployee. The Runemployee class shall contain the main method and will be used to execute the program.
  2. Write a simple payroll program that will display employee's information. Refer to the UML Class Diagram for the names of the variable and method. This should be the sequence of the program upon execution:
  • Ask the user to input the name of the employee
  • Prompt the user to select between full time and part time by pressing either F (full time) or P (part time).
  • If F is press, ask the user to type his monthly salary. Then, display his name and monthly salary.

If P is pressed, ask the user to type his rate (pay) per hour and the number of hours he worked for the entire month separated by a space. Then, display his name and wage.



  1. Create a project named LabExer2
  2. Construct a simple purchasing program based on the UML Class Diagram below.
  • itemName: String
  • itemPrice: double
  • itemQuantity: int
  • amountDue: double


  • setItemName(StringnewitemName): void
  • setTotalCost(int quantity, double price): void
  • getItemName(): String
  • getTotalCost(): double
  • readInput(): void
  • writeOutput(): void

storing the input to the next variable name based on data type

For String s.nextLine()

For int s.nextInt()

For double: s.nextDouble()


Create objec-oriented programming that well implement this principle:



"According to plato, a man should marry a woman who is half his age plus 7 years"




Create the following:



1. Two (2) classes (MyMainClass & TheOtherClass)



2. Two (2) mutator methods:



•setName - accepts a man's name then copies that name to the attribute "name"



•setAge - accepts a man's age then copies that age to the attribute "man_age"




3. Two (2) accessor method:



•getName (String) - returns the man name attribute "name"



•getWomanAge(int) - returns the woman's age attribute "woman_age"




Sample output:



Enter the man's name: Hansel



Enter the man's age: 36



Hansel should Mary a girl who's 25 years old.

LATEST TUTORIALS
APPROVED BY CLIENTS