Q1. Write a program using methods to find whether a point (x1,y1) lies on a circle of radius 2 cm and h = 5; the equation of circle is given by 〖(x-h)〗^2+〖(y-h)〗^2=r^2 . The method returns a Booleanvalue.
write a recursive function which takes 2 input parameters. The first is an employee id and the second is another employee id. We need this function to check if the second Employee is one of the direct or indirect managers, it must returntrueif the second employee is one of the reporting line for the first employee, otherwise it will returnfalse
Emp Id int primary key,
Name varchar(50) not null,
Manager int references Employee (Emp_ld),
JobTitle int references JobTitle(JTId)
You first have to figure out who's "at the top"; then you can recurse down the "tree": That would be the "one" with NO "Manager" (everyone else MUST have one). If you have more than one without a manager, then you have a leadership problem.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
I am new to Java but I have worked on the Microsoft product stack. Is there a "make" and/or "project" file equivalent in Java and is there such a project file that is only associated with whichever IDE I am using?
I am just an amateur javac user, buidling occasionally some simple applications.
Meaning i dont know much of programming generally.
I will try to express my problem as quick and clearly.
Here it is.
I am using Netbeans.
I have a 'jimakoskx' Project trying to have there all my succesful/interesting classes
that occasionally i may write....in years.
Like my library Project.
Lets say i have there a 'mess' of 200 classes
(library classes meaning some of them importing 'some of them' ..others may be independent etc)
Now lets say that a friend ask me a simple application.
And because of my Library Project i am ready to finish this application
a)Create a new Project
b)Import the Library project (Properties->Libraries->add)
.......(Copy dependencies because i want to give the 'client' the jar file )
c)easy write the new application
My problem is NOT that i must give to client
the FOLDER containing the application.jar and the library jar.
Ok..even if there be some solution ...this is not what made me come here to ask.
My problem and my question is the following.
My application jar use lets say only 1 class of my library jar.
But because the library jar lets say is 2 MB
then i am distributing (for the application) 2 MB (by importing library)
...plus...some KB of the actual ('new') application.
Now...if this is a big problem .....i can solve this
either by manually copy the interesting classes from library to actual project
either by ...(lets say i have nothing to do)...by creating a program that do it for me.
And the question is ... Is there a way doing this in Netbeans ???
Code is loaded dynamically in java. A class is not loaded until it is referenced. The byte codes contain that information though so it can be dynamically determined. But that doesn't mean it actually runs.
Then a developer can write code that dynamically loads classes. Or they can use libraries that do that.
So normally execution flow needs to be done to determine what runs.
But, for example, what happen if there is a report that only runs on the first of the month and you use execution profiling on the 15th to find all the classes that are used. You will not find the classes used in that report.
So it is manual process...
You use profiling and attempt to execute your application. The profiled classes are the ones that are executed. Anything else isn't. Then build your jar(s) using only those and then completely test the application. If your tests are complete then it should work.
• 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.
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.