Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide the java code for the above question. Please don't post the code as pics. 5 Refreshment The Pan Am 73 flight from Bombay

image text in transcribedimage text in transcribedimage text in transcribed

Please provide the java code for the above question. Please don't post the code as pics.

5 Refreshment The Pan Am 73 flight from Bombay to New York en route Karachi and Frankfurt was hijacked by a few Palestinian terrorists at the Karachi International Airport. Despite the alarming situation prevailing inside the flight, the senior flight purser Neerja Banhot had to wither her fear and rise to the occasion to take extra care of her passengers on board. Firstly, she and her crew decided to provide food and drinks to the passengers. Given n the number of rows of seats in the aircraft and the total number of people in each row, can you determine the total number of passengers in the flight. Input Format The first line of input consists of an integer n, corresponding to the number of rows in the aircraft. Next line consists of the number of people in each row separated by a space. Output Format The first line of output consists of n integers corresponding to the number of people in each row. The second line of output consists of an integer corresponding to the total number of people in the aircraft. Print Invalid Input and terminate the process of getting inputs if any of the inputs is not a positive number. Refer sample input and output for further specifications. Sample Testcases Testcase 1 Input Testcase 1 Output 12 28 30 20 45 135 12 28 30 20 45 Testcase 2 Input Testcase 2 Output Invalid Input Testcase 3 Input Testcase 3 Output 5 Invalid Input 1 2 - 3

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

Students also viewed these Databases questions