Week 3 Discussion Problems

Week 3 Discussion Problems - Week 3 Selection Structure...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Week 3 Selection Structure Problems For each of the problems below, create the class diagram and the logic of the indicated method.   Create  the logic in Visio and pseudo code.  Also, describe what the user interface would look like, and create the  logic of the driver program in Visio and or pseudo code. 1. Develop a class that has an age property that holds the number of years you’ve been alive.  The class  also has a GetDecades method that divides the total number of years by 10, and sends the decades back  to the calling program.   1) CLASS DIAGRAM: Decades ------------------ + Integer age + Double DecadesOld ------------------- + GetDecades() as Double 2) PSEUDOCODE: Begin GetDecades() as Double Declare variables: ... Integer age ... Double DecadesOld DecadesOld= age / 10 [Remark: no selection structure needed, unless you want to round the DecadesOld to a whole number] Return DecadesOld End 3) USER INTERFACE (Form): Title bar: "Age in Decades" Textbox with label: "Enter your age (whole number):" Button with label: "Calculate decades" Label for output: "Decades: 9.9" 4) PSEUDOCODE for Driver Program (button_click event-handler method): Begin button_click() Declare variables: ...objDecades as New Decades ...Double DecadesOld
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Get objDecades.age from textbox DecadesOld=objDecades.GetDecades() Display DecadesOld End 2. Develop a class that has a property which stores the dollar value of an order.   The class has a  CalculateFinalAmount that uses this logic -- If the dollar value is at least $500, the solution reduces the  dollar value by $50. Regardless of the dollar value of the order, the solution calculates a total after adding 
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/27/2009 for the course BIS 311 taught by Professor Marshburn during the Fall '08 term at DeVry Cincinnati.

Page1 / 4

Week 3 Discussion Problems - Week 3 Selection Structure...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online