100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

COS1512 Assignment 2 2023 (762913)

Beoordeling
-
Verkocht
-
Pagina's
26
Cijfer
A+
Geüpload op
28-06-2023
Geschreven in
2022/2023

QUESTIONS WITH ANSWERS

Instelling
Vak










Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
28 juni 2023
Aantal pagina's
26
Geschreven in
2022/2023
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

6/28/2023




COS1512
Assignment 2
2023 (762913)
Questions with answers




Schoeman, Marthie
[COMPANY NAME]

, COS1512 Assignment 2 2023 (762913)


DUE DATE: 3 July 2023
CUT-OFF DATE: 6 July 2023

TUTORIAL MATTER: Chapters 4, 5, 6, 8 and 9 of the Study Guide
Chapters 4 (section 4.6), 5 (section 5.5), 6, 8 and 9
(excluding the optional parts of section 9.2) of
Savitch

WEIGHT: 30%
MARKS: 70




Question 1
Write a program to determine the tuition fees for a student. The program should
use two overloaded functions, each named calcFees, to determine the tuition
fees for a student. Students who repeat a module pay a different fee for the
modules which are repeated. The program should first ask if the student repeats
any modules. If the student repeats, the program should ask for the number of
modules which are repeated.
One of the overloaded functions should accept the number of modules enrolled
for the first time and the fee for those modules as arguments (parameters), while
the other function accepts arguments for the number of modules enrolled for
the first time and the fee for those modules as well as the number of modules
repeated and the fee for those modules. Both functions should return the tuition
fees for the student.
python
Copy code
def calcFees(num_modules, fee):
return num_modules * fee

, def calcFees(num_modules_first_time, fee_first_time, num_modules_repeated,
fee_repeated):
return (num_modules_first_time * fee_first_time) + (num_modules_repeated
* fee_repeated)


repeat_modules = input("Are there any modules being repeated? (yes/no): ")


if repeat_modules.lower() == "yes":
num_modules_first_time = int(input("Enter the number of modules enrolled
for the first time: "))
fee_first_time = float(input("Enter the fee for modules enrolled for the first
time: "))
num_modules_repeated = int(input("Enter the number of modules repeated: "))
fee_repeated = float(input("Enter the fee for repeated modules: "))


total_fees = calcFees(num_modules_first_time, fee_first_time,
num_modules_repeated, fee_repeated)
else:
num_modules_first_time = int(input("Enter the number of modules enrolled:
"))
fee_first_time = float(input("Enter the fee for modules enrolled: "))


total_fees = calcFees(num_modules_first_time, fee_first_time)


print("Total tuition fees: $" + str(total_fees))
In this program, there are two overloaded calcFees functions. The first function
calcFees(num_modules, fee) calculates the tuition fees for a student who doesn't
repeat any modules. The second function calcFees(num_modules_first_time,
fee_first_time, num_modules_repeated, fee_repeated) calculates the tuition fees
for a student who repeats modules.

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
smillanih Chamberlian School of Nursing
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
398
Lid sinds
2 jaar
Aantal volgers
327
Documenten
1239
Laatst verkocht
1 week geleden

3,7

43 beoordelingen

5
23
4
3
3
5
2
5
1
7

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen