Question: QUESTION 41 Write a Java program called TwiCalculator which will calculate and display taxi ride depending on the distance) dhe of (passengers). The program should


QUESTION 41 Write a Java program called TwiCalculator which will calculate and display taxi ride depending on the distance) dhe of (passengers). The program should calculate the price using a return method and display it using void method. The per should do the following a. Declare a method Data to fill in the variable's km and passengers. To call this method, you need to send as appropriate message parameter we "Enter the distance in Kilometer(m)or "Enter the number of passengers". (2 marks) b. Write a method called calculate Price which takes the distance and the number of passengers as input parameters, then calculates the price using the following formula price - km * passnegers (2 marks) c. Write a void method displayPrice to display the price (1 mark) T TT Arial 3(12pt) T- ES Click Save and Submit to save and submit. Click Save All Answers to save all answers. QUESTION 42 Write a Java program named Matrix that generates a two-dimensional array of size 5x2 Then it should fill the array with 10 random integer numbers (numbers' range between 0 and 9 inclusive) The program should display the array elements The program should find and display each row that adds up a total of 10 (1,1,1,2 marks) For example, if the random numbers are: 56 82 00 77 19 Then the program should display 5-6 Click Save and Submit to save and submit. Click Save Ail Answers to save all answers. 00 77 19 Then the program should display 5 6 8 2 0 0 77 1 9 Sum of row 2 : 10 Sum of row 5 : 10 T T T Arial 3 (12pt) V T. 111 - . Windows by click Save and Submit to save and submit. Click Save All Answers to save all Windows how to e ITA ET/-/ E 4)) A hp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
