Free Essay

Prelab Assignment Lab 5

In:

Submitted By afrocdm
Words 471
Pages 2
ITCS 1212L

PreLab 5

Rational and equality operators, logical operators, conditional operators, conditional structures, selective structures, typecasting, and working with debuggers.

Learning Objectives:
● Practice more with if-else-if and switch statements.
● Understand the concept of scope
● Understand the difference between static, local and global variables
● Practice with functions that can return more than a value and whose parameters’ scopes are not local to the function
● Input validation

These pre-labs are directly related to the lab activities. You don’t need to complete the program. What you need to do is to work on the logic and perhaps some key parts of each program and then complete them in the lab.

Assigned: Date of your lab 4
Due: the night before lab 5

Questions Prelab activity for Lab 5A:
Find the difference between two types of returning values.
Implement the following function prototypes (which take hours of work as integer and the rate of pay as float and calculates the net-payment as float) on paper. Also, write a main function which calls both functions. Compare the calculated net values and show the proper message whether or not they match. Name your variables as hours, rate, and netPay.

float calNetPay(int, float); void calNetPay2(float&, int, float);

Also, answer the following questions:
What does the operator & do? Create a table and put all of the variables of the program inside the first column. The second column should show the scope of each variable. For example for calNetpay2 function if you called the integer variables hours, its scope will be the function calNetPay2.

Prelab activity for Lab 5B:

Create a flowchart showing the following scenario: 1. Present the user with a list of options, 1-3 with proper message as indicated below.
2. Get the user’s choice.
3. If it is one, show the max temperature for zipcode 28223.
4. If it is two, show the min temperature for zipcode 28223.
5. If it is three, exit the program.

Prelab activity for Lab 5C:
You saw the following menu-driven program before which determines the max and min temperatures. This time, it is a complete code to calculate the charges for a health club membership.

#include using namespace std;

// Function protoypes char showMenu(); double calculateMembershipRate(char, int); void displayMembershipRate(double);

int main()
{
// Declare variables char choice; // To hold menu choice int months; // To hold the number of months double membershipRate; // To calculate the membership rates

// Function call to display the menu and return the menu // choice choice = showMenu();

// Accept number of months and calculate membership rates if user chooses A, B or C if(choice != 'D') { // Get the number of months cout months;

// Make a function call to calculate the membership rates. Send choice, and months as parameters membershipRate = calculateMembershipRate(choice, months);

// Make a function call to display the final membership rate displayMembershipRate(membershipRate); } else { cout

Similar Documents

Free Essay

Ch 220c

...CH 220C ORGANIC CHEMISTRY LABORATORY Spring, 2015 Section Page 1. General Information 2 2. Safety Information 2 3. Attendance 3 Make-Up Policy 3 4. Laboratory Protocol 3 Assigned Reading 3 Pre-Lab Quizzes 3 Lab Notebook 5 Chemicals 5 Due Dates for Reports 5 5. Orientation 5 In-Lab Information 5 Library Information 5 6. Check-In 6 7. Grading Procedure 6 8. Policy on Cheating 7 9. TA Office Hours 8 10. Faculty Course CoordinatorS 8 11. Course Web Page 8 12. Hints to Minimize Frustration IN ORGANIC CHEMISTRY 8 13. Work Schedule 10 Lab Report Due Date Schedule 10 Experiments 10 14. Supplements 17 A. Extraction of Unknown 17 B. Recrystallization of Unknown Products 18 C. Methyl Benzoate 19 D. Synthesis of Luminol 20 E. Azo Violet 23 1. GENERAL INFORMATION PRE- and CO-REQUISITES Pre- and co-requisites for CH 220C listed in the Course Schedule. Important: Because the lecture and laboratory courses are co-requisites of each other, dropping one of them requires that you drop the other as well, unless the drop occurs during ...

Words: 8040 - Pages: 33

Free Essay

Java Page

...between abstract and concrete classes. To declare abstract methods to create abstract classes. How polymorphism makes systems extensible and maintainable. To determine an object’s type at execution time. To declare and implement interfaces. Why art thou cast down, O my soul? —Psalms 42:5 ■ ■ © Copyright 1992-2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Chapter 10 Object-Oriented Programming: Polymorphism 307 Assignment Checklist Name: Section: Date: Exercises Assigned: Circle assignments Date Due Prelab Activities Matching Fill in the Blank Short Answer Programming Output Correct the Code YES YES YES YES YES YES 1 NO NO 1 YES NO NO NO NO NO NO Lab Exercises Exercise 1 — Payroll System Modification Follow-Up Question and Activity Follow-Up Question and Activity Debugging Exercise 2 — Accounts Payable System Modification YES Labs Provided by Instructor 1. 2. 3. Postlab Activities Coding Exercises Programming Challenges 1, 2, 3, 4, 5, 6, 7, 8 1, 2 © Copyright 1992-2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Chapter 10 Object-Oriented Programming: Polymorphism 309 Prelab Activities Matching Name: Section: After reading Chapter 10 of...

Words: 4624 - Pages: 19

Premium Essay

Teaching Assistant Responsibilities

...Introduction A. Responsibilities As a Teaching Assistant for the Department of Chemistry at The University of Chicago, you will have the following responsibilities: 1. Attend weekly TA meetings These meetings are mandatory. Important information pertaining to the upcoming labs will be provided to you by the Laboratory Director, as well as directions from the lecturing faculty. 2. Run one lab section each week Responsibilities for running the lab include:  arriving at the lab 15 to 20 minutes before class is scheduled to ensure that everything is ready for the students when they arrive;  proctoring the lab until the last student is finished;  making sure that the lab is left CLEAN and ORDERLY (this might mean nagging the students, but it...

Words: 308 - Pages: 2

Premium Essay

Shdujgk

...Name: _____________________________________Date: ____/_____/_____ Course/Session: ___________ PreLab Composition and Resolution of Forces: Force Table Instructions: Prepare for this lab activity by answering the questions below. Note that this is a PreLab. It must be turned in at the start of the lab period. Time cannot be given in lab to perform PreLab activities. After the start of lab activities, PreLabs cannot be accepted. Q1. What is the basic difference between scalars and vectors? Q2. Do the plus and minus signs that signify positive and negative temperatures imply that temperature is a vector quantity? Explain. Q3. Which of the following statements, if any, involves a vector? (a) My bank account shows a negative balance of –15 dollars. (b) I walked two miles due north along the beach. (c) I walked two miles along the beach. (d) I jumped off a cliff and hit the water traveling straight down at 17 miles per hour. (e) I jumped of a cliff and hit the water traveling at 17 miles per hour. Q4. Two vectors, A and B, are added by means of vector addition to give a resultant vector R: R = A + B. The magnitudes of A and B are 2 m and 7 m, respectively, and they can have any orientation. What are the maximum and minimum possible values for the magnitude of R? Q5. Top of Form Q5. During a relay race, runner A runs a certain distance and then hands off the baton to runner B, who runs a certain distance and hands off the baton...

Words: 1445 - Pages: 6

Free Essay

Acc 422

...ECEN 1400 - Introduction to Digital and Analog Electronics Peter Mathys, Spring 2013    Lab 5: Inductors and How to Light White LEDs from 1 Volt Quick Links * Goals of this Lab * Prelab * Lab Experiments Goals of this Lab * Wind a toroidal inductor. * Measure the inductance and the resistance of an inductor. * Use an inductor to step up the voltage of a battery. * Build a circuit for lighting up white LEDs from a 1 Volt battery. This lab is a group activity. The current group assignments are given here. One lab report per group needs to be turned in on D2L. The responsibilites for the successful completion of the lab consist of three parts: The prelab, the actual lab measurements, and the writing of the report. The report will be graded according to three criteria: Correctness, completion, and clarity. On the cover page you must clearly state which group member had the main responsibility for the prelab, for the lab measurements, and for the report writing. All group members need to be knowledgeable for all three parts, but each member has a specific role in the group. The responsibilities must be rotated for future labs so that each group member will have experienced all three roles. Prelab An inductor is a passive device that can store energy in its magnetic field. Two examples of inductors (solenoid on the left, toroid on the right) are shown in the figure below. The i-v relationship for an inductor is: Compare this to the i-v...

Words: 2352 - Pages: 10

Premium Essay

Microscope

...Biology 100 – K. Marr (Revised Spring 2010) Lab 2. Microscopic Observation of Cells Prelab Assignment 1. Before coming to lab, read carefully the introduction and procedures of each part of the experiment. If you and your group members are not familiar with the procedure before coming to lab, you may have difficulty completing this exercise during the lab period. 2. Answer the Prelab Questions on the first three pages of the report sheet and be prepared to hand them in at the start of your lab class. Please be aware that you need to go online to answer prelab question #3. Goals of this Lab Exercise After completing this lab exercise you should be able to..... 1. Identify the parts of a compound light microscope and use a microscope to competently examine biological samples 2. Determine the diameter of the field of view for the various objectives of a microscope 3. Accurately sketch, describe and cite the major functions of the structures and organelles of the cells examined in this lab exercise 4. Estimate the size of specimens viewed with a microscope. The Microscope The microscope is one of the principal tools of the biologist. Without the microscope, many of the great discoveries of biology would never have been made. The light compound microscope, illustrated in Figure 1, is the type of microscope most commonly used. Proper, comfortable use of the instrument demands practice. The practice afforded you in this exercise depends upon familiarity with the parts of the microscope...

Words: 4442 - Pages: 18

Premium Essay

Chemical Equilibrium

...Purpose The main objective of this experiment was to experimentally derive the equilibrium constant for the reaction between iron (III) and thiocyanate ions. The second objective of this experiment was to use the spectrophotometer to measure the absorbance of light by [FeSCN2+] at various concentrations and then to plot its corresponding calibration curve to mathematically determine the concentration of [FeSCN2+] at equilibrium. The final objective of this experiment was to observe Le Chatelier’s Principle when stress was applied to the reaction between iron (III) and thiocyanate ions and to determine in which direction the react shifted to maintain equilibrium. Introduction Chemical reactions do not always run to completion, such that the entire limiting reagent or all reactants are consumed entirely. In many cases many chemical reactions establish an equilibrium, where the amount of reactants and products are constantly in flux in an effort to maintain a set amount. At equilibrium the rate of the forward reaction equals the rate of the reverse reaction. Le Chatelier’s Principle states that if any stress is applied to the reaction when it is at equilibrium, the reaction will shift in order to re-obtain equilibrium. The resulting shift can either be a reduction or increase in the amount of product or the reactant. If there is a decrease in the amount of reactant and an increase in the amount of product the reaction has shifted...

Words: 4727 - Pages: 19