Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

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

Milestone:

For this unit, you are required to develop a GUI application using Java. The application should connect to a database and should be able to perform any CRUD operation.


Main goal: 

Develop a Java application with GUI for a primary school called Duka.


Functional Requirements:

The application should allow: 

i. A shop attendant to be able to login to upload stock of items (with prices). ii. A buyer be able to search for items, get their prices and make an order.


Non-functional Requirements:

The application should:

i. Have a user-friendly GUI for both shop attendant and buyer.

ii. Not crash in case a user makes a mistake, instead it should provide a clarification/warning.


Construct a class called Rectangle. A Rectangle has both a length and a width (both positive integers). Access to them should be only inside the class and within the inheritance hierarchy. Then implement the following:

  • lone constructor that accepts two integers for the length and the width. Prints "Rectangle Constructor"
  • getters and setters
  • area - prints "Rectangle Area" and returns the area of the rectangle
  • perimeter - prints "Rectangle Perimeter" and returns the perimeter of the rectangle


Square construction prints "Square Constructor" and accepts one integer which is the length of a side. The version of the area and perimeter of Square prints "Square Area" and "Square Perimeter", respectively.

Input

A positive integer representing the length of the side of a Square.

2

Output

The message of the constructors when called, the area, and perimeter of Square.

Rectangle·Constructor
Square·Constructor
Square·Area
Area:·4
Square·Perimeter
Perimeter:·8






Create a class hierarchy that will represent trips, including member variables to store trip details. Create member functions that will:

  • compute the cost of the trip, and
  • display the details of the trip: origin, destination, distance and cost


Study the sample output carefully so you can correctly implement the trip hierarchy. 

Input


5
1·Zamboanga·Cagayan·494·5
1·Tagbilaran·Panglao·20·10
2·Cebu·Tagbilaran·90·800
3·Manila·Davao·1500·4500
3·Clark·Iloilo·751·2300

Output


Trip·Constructor
Bus·Constructor
Bus·Trip:·Zamboanga·to·Cagayan,·494·km,·P5·base·fare
Trip·Constructor
Bus·Constructor
Bus·Trip:·Tagbilaran·to·Panglao,·20·km,·P10·base·fare
Trip·Constructor
Boat·Constructor
Boat·Trip:·Cebu·to·Tagbilaran,·90·km,·P800·base·fare
Trip·Constructor
Plane·Constructor
Plane·Trip:·Manila·to·Davao,·1500·km,·P4500·base·fare
Trip·Constructor
Plane·Constructor
Plane·Trip:·Clark·to·Iloilo,·751·km,·P2300·base·fare
Total·Cost·of·trips:·10950




Write a program to take a String name as input without using array and display the name in the format that even words will be first letter only.

Enter a String

Hun leij cenr xanf ewasn

Hun l. cenr x. eswasn

Hint: Use trim(), indexOf(), lastIndexOf(), charAt(), substring() if necessary.

Don't use Character class and split


Create class SavingsAccount. Use a static variable annualInterestRate to store the annual

interest rate for all account holders. Each object of the class contains a private instance variable

savingsBalance indicating the amount the saver currently has on deposit. Provide method

calculateMonthlyInterest to calculate the monthly interest by multiplying the

savingsBalance by annualInterestRate divided by 12—this interest should be added to

savingsBalance. Provide a method modifyInterestRate that sets the

annualInterestRate to a new value.

Write a program to test class SavingsAccount. Instantiate two savingsAccount objects, saver1

and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to

4%, then calculate the monthly interest for each of 12 months and print the new balances for both savers.

Next, set the annualInterestRate to 5%, calculate the next month’s interest and print the new

balances for both savers. Also, provide the UML class diagram of your class.


2. Postfix Calculator

by CodeChum Admin

One good implementation of computing infix expressions is to transform them to postfix and then evaluate via the postfix expression.


Infix expressions is the common way of writing arithmetic expressions. The binary operator come between them as shown below:


More info here, Important!

https://pastebin.com/6qLXQ9Md

1. Binary Search

by CodeChum Admin

Searching is one very important Computer Science task. When you have a list, searching is natural. You would want to search for an item in the list. If the list is not sorted, there is no way to it but do a linear search - check each element until the item is found or until there are no elements left to inspect.


More info here, Important!

https://pastebin.com/eZWPNhh9


2. More Shapes

by CodeChum Admin

Since we are interested with drawing in this quiz (it seems), consider a Shape object. We know that for regular shapes (like Rectangle and Circle), they have properties like area and perimeter. Let's also assume that these Shapes have color (simply a String for the purpose of this quiz) and whether the shapes are filled with this color or not (boolean).


More info here, Important!

https://pastebin.com/hFgYeMFH


You probably are fond of games. This quiz though is not that complicated. You are simply going to work with a point on a screen, and a circle on a screen as well. And let's consider them as the characters in the game. We are going to call both of these characters as Movable objects. Objects are said to be Movable if they can be moved around the screen. The following simple movements are allowed:


public void moveLeft();
public void moveRight();
public void moveUp();
public void moveDown(); 
public void display();
public void moveLeft();
public void moveRight();
public void moveUp(); 
public void moveDown();
public void display();


Input

- 1 moveLeft()

- 2 moveRight()

- 3 moveUp()

- 4 moveDown()

1
0·0
5
4
4
2
2
1


Output

A single line simply printing the string returned by toString().

Point:·(1,2)


More info here, Important!

pastebin.com/05W0gkTx




Write an application that accepts the unit weight of a bag of coffee in pounds and

the number of bags sold and displays the total price of the sale, computed as

total price = unitweight * number of units * INR 25;

total price with tax = total price + totalprice * INR 0.70,

where 25 is the cost per 200grams and 0.70 is the sales tax. Use data type of

float.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS