Purchase Solution

Switch Statements

Not what you're looking for?

Ask Custom Question

Make this program using switch statements in Visual Basic/C++.

Based the tuition fee of the student to the following:

Year Code Year Name Downpayment
1 Freshmen 10% of tuition fee
2 Sophomore 15% of tuition fee
3 Junior 20% of tuition fee
4 Senior 25% of tuition fee

Course Code Course Name Rate per Unit
A BSCS 205.50
B ENGG. 195.75
C MNGT 180.50
D ARCHI 175.25

Computation: tuition fee= number of units x Rate per unit
balance of tuition fee= tuition fee - downpayment

Enter the year code, course code, number of units and output the year name, course name, tuition fee and the balance tuition fee of the student.

I'm just not sure on putting multiple switch statements.

Purchase this Solution

Solution Summary

The solution contains program code in Visual Basic and C++ that demonstrates usage of a "switch" statement. Based on year code and course code, the total tution fee is calculated. The switch parameters help us determine the down payment percentage and rate per unit.

Solution Preview

I am providing the code in Visual Basic and in C++, but it would be structured identically in other languages just using different syntax. First the input parameters are declared - that's what user would input. Secondly output parameters - that's what user will have as a result. Calculation variables are used for internal calculation. The first switch determines the rate, the second - the downpayment percent. Once you have this data you can compute the tuition fee and the balance.

'Input parameters
Dim inputYearCode As Integer = 1
Dim inputCourceCode As String = "A"
Dim inputUnits As Integer = 20

'Output parameters
Dim outTuitionFee As Double
Dim outBalance As Double
Dim outCourseName As String
Dim outYearName As String

'Calculation ...

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

C++ Operators

This quiz tests a student's knowledge about C++ operators.