Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

4. What sales experience have you had?

Answered: 1 week ago

Question

15-5 How will MIS help my career?

Answered: 1 week ago