Click here to Skip to main content
15,867,771 members
Home / Discussions / Java
   

Java

 
QuestionWrite a Java program to print the division of certificate. The division is determined as follows: Rate from 0 to less than 2:"Fail" Rate from 2 to less than 3:"Third" Rate from 3 to less than 4:"Second" Rate from 4 to 5:"First" Pin
Member 1576643824-Sep-22 9:58
Member 1576643824-Sep-22 9:58 
AnswerRe: Write a Java program to print the division of certificate. The division is determined as follows: Rate from 0 to less than 2:"Fail" Rate from 2 to less than 3:"Third" Rate from 3 to less than 4:"Second" Rate from 4 to 5:"First" Pin
Victor Nijegorodov24-Sep-22 21:40
Victor Nijegorodov24-Sep-22 21:40 
AnswerRe: Write a Java program to print the division of certificate. The division is determined as follows: Rate from 0 to less than 2:"Fail" Rate from 2 to less than 3:"Third" Rate from 3 to less than 4:"Second" Rate from 4 to 5:"First" Pin
Richard MacCutchan25-Sep-22 3:46
mveRichard MacCutchan25-Sep-22 3:46 
GeneralRe: Write a Java program to print the division of certificate. The division is determined as follows: Rate from 0 to less than 2:"Fail" Rate from 2 to less than 3:"Third" Rate from 3 to less than 4:"Second" Rate from 4 to 5:"First" Pin
Richard Deeming25-Sep-22 21:25
mveRichard Deeming25-Sep-22 21:25 
GeneralRe: Write a Java program to print the division of certificate. The division is determined as follows: Rate from 0 to less than 2:"Fail" Rate from 2 to less than 3:"Third" Rate from 3 to less than 4:"Second" Rate from 4 to 5:"First" Pin
Richard MacCutchan25-Sep-22 22:09
mveRichard MacCutchan25-Sep-22 22:09 
QuestionHow to package Jar by copying ONLY USED classes from onother jar ?! Pin
jimakoskx18-Sep-22 17:48
jimakoskx18-Sep-22 17:48 
AnswerRe: How to package Jar by copying ONLY USED classes from onother jar ?! Pin
jschell23-Oct-22 11:30
jschell23-Oct-22 11:30 
QuestionJava program project using netbeans Pin
Member 1576471312-Sep-22 0:20
Member 1576471312-Sep-22 0:20 
Instructions:

•   This formative assessment consists of THREE Questions. (Answer ONLY TWO)
•   The assessment is based on units 4 – 5 (Chapter 12 – 14 of the Java Programming Textbook).
•   You can use either a console or Java Swing components (GUI) to answer your programming questions.
•   Answer the questions outlined in the answer sheet and submit the completed sheet as a pdf.
•   The code (programs) as described in the questions must be submitted as well.
•   NOTE:   SECTION A QUESTION 1 IS COMPULSORY.
SECTION B SELECT ONE QUESTION (QUESTION 2 OR QUESTION 3).

The assessment covers the following learning outcomes:

•   Use recursion to solve mathematical problems
•   Use the List interface
•   Use the ArrayList class
•   Use Swing components to capture and output information.

SECTION A (QUESTION 1 IS COMPULSORY)

Question 1  [25 marks]
Fun Times is a tourism company that provides adventurous itineraries around South Africa that are unique and engrossing. Fun Times co. specializes in group trips, with groups typically including 50 or more people. The company needs you to develop an application to capture trips and calculate their costs.

Use NetBeans IDE for all your programming questions. Create a class (Trip) to hold trip data for Fun Times. Your class header statement must be as follows:

}
Inside the class make sure you complete the following tasks:

1.1 Create four private variables that hold a trip number, number of guests for the trip, the price per guest, and the price for the trip. The trip number is stored as a String because the company plans to assign trip numbers such as T123. (4 marks)

1.2 Create two public setter methods that set/modify the trip number (setTripNumber()) and the number of guests (setGuests()). The setGuests() method will calculate the trip price by taking the number of guests multiplied by the price per guest every time the number of guests is set. The trip number MUST always be set as four digits (First a character followed by three numbers). If the input is otherwise the program must use a default trip number T000.
(6 marks)

1.3 Create three public getter methods that return the values in the three non-static fields. getTripNumber(), getGuests(), and getPriceForTrip().  (5 marks)

1.4 Create a constructor that accepts a trip number and number of guests as parameters. Pass these values to the setTripNumber() and setGuests() methods, respectively. (5 marks)

The constructor calculates the price charged for the trip by multiplying the number of guests by the price per guest. The price per guest is R500 for small trips (50 guests or fewer) and R550 for large trips (more than 50 guests).

Use a default constructor provided for you below that passes T000 and 0 to the two-parameter constructor.

1.5 Create a toString() method that returns the trip number, number of guests, and total price in a readable format.    (5 marks)

Use a compareTo() method provided for you below that overrides the Object class compareTo() method to compare trips based on their total price.

AnswerRe: Java program project using netbeans Pin
Dave Kreskowiak12-Sep-22 1:21
mveDave Kreskowiak12-Sep-22 1:21 
GeneralRe: Java program project using netbeans Pin
Gerry Schmitz12-Sep-22 6:27
mveGerry Schmitz12-Sep-22 6:27 
QuestionSocket connection offline vs busy Pin
JohnCodding9-Aug-22 20:26
JohnCodding9-Aug-22 20:26 
AnswerRe: Socket connection offline vs busy Pin
Richard MacCutchan9-Aug-22 21:03
mveRichard MacCutchan9-Aug-22 21:03 
GeneralRe: Socket connection offline vs busy Pin
JohnCodding9-Aug-22 21:10
JohnCodding9-Aug-22 21:10 
GeneralRe: Socket connection offline vs busy Pin
Richard MacCutchan9-Aug-22 21:12
mveRichard MacCutchan9-Aug-22 21:12 
GeneralRe: Socket connection offline vs busy Pin
Richard MacCutchan9-Aug-22 21:17
mveRichard MacCutchan9-Aug-22 21:17 
GeneralRe: Socket connection offline vs busy Pin
JohnCodding9-Aug-22 21:36
JohnCodding9-Aug-22 21:36 
GeneralRe: Socket connection offline vs busy Pin
Richard MacCutchan9-Aug-22 21:45
mveRichard MacCutchan9-Aug-22 21:45 
AnswerRe: Socket connection offline vs busy Pin
Gerry Schmitz10-Aug-22 4:13
mveGerry Schmitz10-Aug-22 4:13 
AnswerRe: Socket connection offline vs busy Pin
englebart12-Oct-22 15:20
professionalenglebart12-Oct-22 15:20 
QuestionUser Path not working until computer restart Pin
Valentinor13-Jul-22 9:27
Valentinor13-Jul-22 9:27 
AnswerRe: User Path not working until computer restart Pin
Valentinor13-Jul-22 23:28
Valentinor13-Jul-22 23:28 
AnswerRe: User Path not working until computer restart Pin
englebart12-Oct-22 15:26
professionalenglebart12-Oct-22 15:26 
QuestionDistribute software that uses Java Pin
Valentinor7-Jul-22 9:28
Valentinor7-Jul-22 9:28 
AnswerRe: Distribute software that uses Java Pin
Gerry Schmitz7-Jul-22 19:46
mveGerry Schmitz7-Jul-22 19:46 
AnswerRe: Distribute software that uses Java Pin
Dave Kreskowiak8-Jul-22 11:30
mveDave Kreskowiak8-Jul-22 11:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.