Sam & Ella's Delikatessen brauchen ein Programm, das Bestellungen über ein Internetformular entgegen nimmt. Das Programm fragt welchen Artikel der Kunde möchte, den Preis und ob der Artikel per Express verschickt werden soll. Für Artikel unter $10 betragen die Versandkosten $2.00. Kostet der Artikel $10 oder mehr betragen sie $3.00. Der Expresszuschlag beträt $5.00.
(Ein richtiges Internet Bestellformular würde natürlich andere I/O Methoden verwenden.)Geben Sie den Artikel ein: Tuna Salad Geben Sie den Preis ein: 450 Expressversand (0==nein, 1==ja) 1 Rechnung: Thunfisch Salat: 4.50 Versand : 7.00 Gesamt : 11.50
Zurück zur Übersicht.
The maximum possible efficiency of a steam engine depends on the temperature of the steam in the boiler and the temperature of the outside air:
where Tair is the air temperature and Tsteam is the steam temperature. The temperatures are give in degrees above absolute zero. Normal air temperature is about 300oK. Boiling is 373oK. Write a program that asks the user for the air temperature and the steam temperature and writes out the maximum possible efficiency of a steam engine. However, if the steam temperature is less than 373oK there is no steam, so the efficiency is zero.efficiency = 1 - Tair / Tsteam
Use integer or floating point input, but do the calculations in floating point.
Zurück zur Übersicht.
A microwave oven manufacturer recommends that when heating two items, add 50% to the heating time, and when heating three items double the heating time. Heating more than three items at once is not recommended.
Write a program that asks the user for the number of items and the single-item heating time. The program then writes out the recommended heating time.
Hint: do this with four successive single-branch if statements each of which tests for one of the four cases: 1 item, 2 items, 3 items, more than three items. Look at the sports car purchase program in the chapter to see how to do this, if you are stuck.
Click here to go back to the main menu.In a new role-playing fantasy game players get to design their character by picking a point value for each of three characteristics:
(This user interface could get much more complicated. You might want to implement some of your own ideas.)Welcome to Yertle's Quest Enter the name of your character: Chortle Enter strength (1-10): 8 Enter health (1-10): 4 Enter luck (1-10): 6 You have give your character too many points! Default values have been assigned: Chortle, strength: 5, health: 5, luck: 5
Zurück zur Übersicht.