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

Considering the Java program in section 6.3.3 “Dragging” of Eck (2019), describe what it does in response to specific operations of the mouse (mousePressed, mouseDragged, and mouseReleased), and how it does it. 

You are encouraged to run the SimplePaint program for yourself to test its behavior. Then read through the program carefully to understand how that behavior arises.


Create a class called Match that will have team the class must have the following data members and methods:









Data Members:





• This class has two data members named HomeTeam and VisitorTeam which are of type Team, they will store that two teams that will play the Match.





Methods:





• This class doesn’t have a default constructor, it only has one constructor which receives two Team object that will be assigned to HomeTeam and VisitorTeam.





• setTeams(),which receives two Team object that will be assigned to HomeTeam and VisitorTeam.





• playMatch(), simulates match play by calling the scoreGoals methods of each team.





• getPlayGound(), returns the ground of play which is the HomeGound of the HomeTeam.





• isDrawMatch(), will return true if the Match is a draw and false if there is a winner. The match is a draw if the goals of the teams are equal.





• getWinner(), returns the team which won the match, a team wins if its goals is higher than the goals of the other team.









In Java , Write a class Marks with three data members to store three marks. ... Create two constructors and a method to calculate and return the sum 

Create a java program of following output.

Output:

My name is Nico Sumpang

The sum is: 10

The difference is: 5

The product is: 20

The quotient is: 2.5

St. Augustine SY 2020-2021


Design a Car model class under package :package6 with the following attributes:




Member Field Name



Type



licenceNumber



String



Model



String



currentMileage



Double



engineSize



Intege



Mark all the attributes as private & create appropriate Getters & Setters




Design another class as Main under package :package6, where you need to implement logic as follows:



Declare an array as Car with size 10.



Take 10 Carà ƒ ¢ € ™s information from user and store them in specified array.



Call findCarList method from Main class to get all cars information related to a given current Mileage & engine Size



Current Mileage & engine Size values should be taken from Main class and pass to findCarList method as argument as well as Car array (with size 10).



Design findCarList method in Car class as follows

Create a class called OneDimArray then create a private generic array of type Object inside class, initialize array using constructor then implement the following methods inside class, then create a driver class called OneDimArrayTest for testing your program. Test your program with integers.

 

·        + Boolean addItem(item)

·        + Boolean addItemAt(index, item)

·        + Object removeItemAt(index)

·        + Object removeItem(index, item)

·        + Object deleteItemIfOdd(item)

·        + Boolean isEmpty()

·        + Boolean isFull()

·        + Object getItemAt(index)

·        + Boolean setItem(index, item)

·        + void swapItems(index1, index2)



construct a simple purchasing program


2. Write a program in Java to take the postfix form of a mathematical expression. Evaluate the postfix expression and print the result. The postfix expression will contain single-digit operands and ‘+’, ‘-‘, ‘*’, and ‘/’ operators. You can use relevant Java built-in classes in your code. The sample inputs/ outputs are given below: Sample inputs and outputs: (User’s inputs are shown in bold) The postfix expression: 543*+82/- The final result: 13


Assume an operating system follows First Come First Serve (FCFS) process scheduling algorithm. In the FCFS scheduling, processes are allocated to the CPU for execution as per their arrival sequence. Write a menu-driven program in Java to implement FCFS scheduling algorithm using a queue. Users can execute as many processes as they wish. Your program will follow the menu options to insert a new process in the queue, allocate the first process waiting in the queue to the CPU for execution, and to print appropriate messages depending on the situations. You can use relevant Java built-in classes in your code. The sample inputs/ outputs are given below: Sample inputs and outputs: (User’s inputs are shown in bold) Press 1 to insert a new process to the process queue Press 2 to allocate a process to the CPU for execution Press 3 to terminate the program Enter your choice: 2 Sorry, no process is available in the process queue Enter your choice:


Discount Fly is an airline which needs you to create a program to store a customer's name, address, city, province and postal code to a text file. When the program first executes, it should display any information which is already saved into the file. After the contents of the file are displayed, ask the user how many customers to add. Use a loop, input all of the customer information and write the data to the file. Use the append method so you don't lose any information currently in the file.

For full marks, you will need to provide error guards in any input which can cause errors. You will also need to validate the postal code to ensure it is in a valid Canadian postal code format. The format is L#L #L#, where L is a letter and # is an integer. You will need to extract each character one at a time and determine if it is a letter or number.



LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS