This task is based on your prac 3, where you needed to implement a program for a car salesman who wants to keep record of the cars he has for sale. For each car he keeps the following: Registration Number (always unique), Model, Colour and Price You can carry on with your own solution, and update it to do the following: Cars should be classified as cheap if the selling price is < R50 000 Make use of the CarPracSkeletonCode file, to implement the methods in CarList related to sorting. Test whether your sorting is valid by calling the public sorting methods from the application class. Alternatively, you can start a new Console application, create the required classes and copy the partial code from the CarPrac SkeletonCode document to the relevant classes Then implement the methods in Carlist related to sorting. Test whether your sorting is valid by calling the public sorting methods from the application class.
Consider the following unsorted list of integers 8 3 1 12 5 9 a) Show the content of the array after each pass when using the Bubble Sort, to sort the list in ascending order. b) Show the content of the array after each pass when using the Selection Sort, to sort the list in descending order. c) Show the content of the array after each pass when using the Insertion Sort, to sort the list in ascending order.
4. One of the purposes of asymptotic analysis is to compare algorithms. Use the codes of selection and bubble sort program you have written and decide which algorithm performs better.
I. Use the random number generator you programmed and generate a list of 100 items.
The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers.
Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well.
Off you go!
Input
A line containing two integers separated by a space.
6·9Output
A line containing an integer.
3Remember the game of FizzBuzz from the last time? Well, I thought of some changes in the game, and also with the help of loops as well. Firstly, you'll be asking for a random integer and then loop from 1 until that integer. Then, implement these conditions in the game:
print "Fizz" if the number is divisible by 3
print "Buzz" if the number is divisible by 5
print "FizzBuzz" if the number is divisible by both 3 and 5
print the number itself if none of the above conditions are met
Input
A line containing an integer.
15
Output
Multiple lines containing a string or an integer.
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
A bagel shop charges 75 cents per bagel for orders of less than a half-dozen bagels and 50 cents per bagel for orders of a half-dozen or more. Write a program that requests the number of bagels ordered and displays the price for each bagel and the total cost. Format the output results with two decimal places
USING IF ELSE CONDITIONAL STATEMENT
Write a JAVA program that will input Employee Name, Rate per hour, No. of hours worked
and will compute the daily wage of an employee. If the number of hours worked exceeds
eight hours add 30% to each excess hour as overtime rate.
Formula: Daily Wage = Rate per hour * No. of hours worked + OT pay
Write a C program that displays the following menu on the screen:
MENU OF OPERATIONS
By: <Your Name Here>
[ 1 ] - Addition
[ 2 ] - Subtraction
[ 3 ] - Multiplication
[ 4 ] - Division
[ 5 ] - Modulo Division
[ 6 ] - Quit
Enter Your Choice: 3
You have chosen Multiplication!
Enter three integers: 89 78 67
Sum = 465,114
Thank you for using my program...
The user has to be prompted to input a number of his/her preferred operation and will then be asked to enter three integers and display the computed value based on the inputted operation.
Create a C program that accepts 3 integers and display separately the highest and the lowest among them.
Sample Run:
Enter 3 integers: 36 54 45
Highest: 54
Lowest: 36
IF ELSE CONDITIONAL STATEMENT
Write a JAVA program that will input the following data: Student Name, Average, Tuition Fee
and output Total Tuition Fee.
Formula: Total Tuition Fee = Tuition Fee – Discount
If average is: 95 – 100 100% discount
90 – 94 25%
85 – 89 10%
84 and below no discount