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

5. A travelling salesman records his mileage at the end of each week in order to make an accurate claim for expenses.


Write a Java code:

* With a class called Travelling which has a calculateExpenses method which is to prompt the user to input the date and the number of kilometres travelled.

* Perform a validation to ensure that the number of kilometres is an integer greater than 0.


* The method should be written within the same class:

- The first 100 kilometres is paid at R1.20 per kilometre.

- If the of kilometres is more than 100, all additional kilometres are paid at R1.50 per kilometre


* Output:

- The date : 04/28/2022

- The number of kilometres travelled: 200

- The total expenses due : R270.0


4. The Litsemba Group Life Insurance company computes annual policy premiums based on the age the customer turns in the calendar year. The premium is computed by taking the decade of the customer's age, adding 15 to it, and multiplying by 20. For example, a 34 year would pay R360 which is calculated by adding the decades (3) to 15 and multiplying by 20. Write a Java application that prompts a user for the current year and a birth year. Pass both to method that calculates and returns the premium amount and display the returned amount. Application should be named Insurance.java . Note: The customer should not be older than 59 years . [10 Marks]


create a console application to test usage of switch case construct. Accept some integer from user as command line argument and using a switch case construct

create a simple circular linked list structure that manages a list of employees read from a file and write the function that deletes all the employees with an even in O(n) complexity

( Data structure )

Is software engineering applicable when Web Applications are built? If so, how might it be modified to accommodate the unique characteristics of Web Applications?

 

Question:

 

Most agile process models recommend face-to-face communication. Yet today, members of a software team and their customers may be geographically separated from one another. Do you think this implies that geographical separation is something to avoid? Can you think of ways to overcome this problem?



Implement a class named RandNum. The class should have a 5x5 2D array of 25 integers. The constructor should use the random() function to generate a random number in the range of 1 to 100 for each element in the array. Implement a method to calculate the minimum, maximum and average of the 25 values. Implement a method to display the values of the array, minimum, maximum and average of the 25 values


You will be given a list of tuples where each tuple indicates a point i.e. (x, y) in a 2-dimensional coordinate system. You need to write a python program to find the minimum distance and the point that is closest to the origin i.e. (0,0)

Hint:

The formula of distance =√ [ (x₂ - x₁)² + (y₂ - y₁)²]

As you are calculating the distance from the origin (0,0), you can simply use distance = √ [ (x²+y²)] 

You can create a list of distances from each point and sort that list using your personal favorite sorting algorithm.


Sample Input 1 

points = [(5,3), (2,9), (-2,7), (-3,-4), (0,6), (7,2)] 

Sample Output 1 

Minimum distance = 5.0 

Here the closest point is (-3,-4) which has a distance of 5.0 from the origin.


Sample Input 2 

points = [(1,7), (4,5), (-1,7), (-2,0), (1,1), (5,-1)] 

Sample Output 2 

Minimum distance = 1.4142135623730951 Here the closest point is (1,1) which has a distance of 1.4142135623730951 from the origin.


Make a program that will accept an integer and loop for the same number of times as that of the inputted integer and input random integers and add it to the array/list one by one, per line. Afterwards, make your program accept another random integer.

Using that final integer, compare from your array/list if the final integer's value is also present in your current array/list. If so, print "Present"; otherwise, print "None".

 

Start coding now!

Input

The first line contains the size of the array/list.

The next lines contain the integers.

The last line contains an integer to be searched.

5

3

21

2

5

23

2

Output

A line containing a string.

Present


You will be given a list of tuples where each tuple indicates a point i.e. (x, y) in a 2-dimensional coordinate system. You need to write a python program to find the minimum distance and the point that is closest to the origin i.e. (0,0)

Hint:

The formula of distance =√ [ (x₂ - x₁)² + (y₂ - y₁)²]

As you are calculating the distance from the origin (0,0), you can simply use distance = √ [ (x²+y²)] 

You can create a list of distances from each point and sort that list using your personal favorite sorting algorithm.


Sample Input 1 

points = [(5,3), (2,9), (-2,7), (-3,-4), (0,6), (7,2)] 

Sample Output 1 

Minimum distance = 5.0 

Here the closest point is (-3,-4) which has a distance of 5.0 from the origin.


Sample Input 2 

points = [(1,7), (4,5), (-1,7), (-2,0), (1,1), (5,-1)] 

Sample Output 2 

Minimum distance = 1.4142135623730951 Here the closest point is (1,1) which has a distance of 1.4142135623730951 from the origin.


SNAKY CONVERSION

you are given a string S print the string in N rows containing a snaky pattern represenation as described below

INPUT:the first line should be a string

explanation:

s=AWESOMENESS N=4

consider the following snaky representation of the word

A E

W M N

E O E S

S S

the first row contains characters AE

the 2nd row contains characters WMN

the 3rd row contains characters EOES

THE fourth row contains characters SS

INPUT:

NEWSLETTER 3

OUTPUT:

NLE

ESETR

WT

INPUT:AWESOMENESS 4

OUTPUT:

AE

WMN

 EOES 

SS


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS