Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you do quickly plz C6,CO4,PO2] Question 7 Soalan 71 A small elevator can safely carry a load of no more than 500 kilograms. If

Can you do quickly plz image text in transcribed
C6,CO4,PO2] Question 7 Soalan 71 A small elevator can safely carry a load of no more than 500 kilograms. If this load limit is exceeded, the elevator cable will snap and all the occupants will be kiled. Initially the elevator is empty and several people are waiting in line. There is a scale outside the elevator door so that each person can be weighted to determine whether he or she will be allowed on the elevator. To make the problem easier, assume that if the next person in line will cause the load limit to be exceeded, the elevator doors will close. That is, no attempt is made to search farther back in the line for a lighter person who will not cause the load limit to be exceeded. Using repetition and selection structure, write a C program to simulate this situation (Hint: Analyze the sample output in Figure 15 to determine the solution.) Sebuah lif kecil boleh mambawa muatan tidak lebih dari 500 kilogram. Sekiranya muatan melebihi had, kabel lif akan putus dan semua penumpang akan terbunuh. Permulaannya lif kosong dan beberapa orang memunggu di barisan. Ada satu mesin penimbang di luar pintu lif supaya setiap orang boleh di timbang untuk menentukan sama ada dia dibenarkan menaiki lif. Untuk memudahkan masalah ini, anggapkan sekiranya orang seterusnya di dalam barisan akan menyebabkan muatan melebihi had, pintu lif akan ditutup. laitu, tiada percubaan seterusnya untuk mencari orang yang lebih ringan di dalam barisan yang tidak mengakibatkan muatan melebihi had. Dengan menggunakan struktur pengulangan dan pemilihan, tulis aturcara C untuk mensimulasi situasi ini Tip: Analisa sampel keluaran di Rajah 15 untuk menentukan penyelesaian)) Sample output: Enter new proposed weight: 100 New100 Total 100 Enter new proposed weight: 200 New200 Total300 Enter new proposed weight: 175 New 175 Total- 475 Enter new proposed weight: 99 NOT ALLOWED. This will give a total load of 574 Figure 15 Rajah 15)

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

ISBN: 3540416641, 978-3540416647

More Books

Students also viewed these Databases questions