This document provides instructions for completing an OMP 220 programming lab assignment involving object-oriented programming concepts in C++. It describes creating classes to model bank accounts, including a base BankAccount class and derived CheckingAccount and SavingsAccount classes. The lab involves implementing class definitions, member functions, and a test program to simulate transactions on checking and savings account objects. Key requirements and deliverables are submitting source code and a lab report describing the program design, testing process, and answers to questions.
1. OMP 220 Complete
Class/OMP220
Click Link Below To Buy:
https://hwaid.com/shop/omp-220-complete-classomp220/
Contact Us:
hwaidservices@gmail.com
OMP 220 Complete Class
COMP 220 iLab 1 Two-Dimensional Arrays Lab Report and Source Code
COMP 220 iLab 2 Resistor Lab Reportand Source Code
COMP 220 iLab 3 Bank Account Lab Reportand Source Code
COMP 220 iLab 4 Composition Lab Reportand Source Code
COMP 220 iLab 5 Lab Report and Source Code
COMP 220 iLab 6 Overloaded Operators Lab Report and Source Code
COMP 220 iLab 7 Polymorphism Lab Reportand Source Code
COMP 220 iLab 1 Two-Dimensional Arrays Lab Report and Source Code
BlackJack Table
Specification:Include a briefdescription ofwhat the program accomplishes,including its input,key processes,and
output.
There is always a dealer in the game.At the startof the game,the dealer’s firstcard will not be shown or displayed.
The second card will be displayed.The dealer may
draw additional cards.The dealer mustuse a random-number generator to determine the maximum number ofcards
the dealer will draw–a value between 0 and 3.
In other words,the dealer is a computer player. The dealer does notshow all the cards or the total until a ll the players
have either gone bust(over 21) or hold (no more
cards drawn).There mustbe at leastone other player (you) and up to a maximum offour other players (all played by
you).
. On a player’s turn, that player may either draw a card or hold.Once a player holds,he or she should notbe asked to
draw another card during this game.
All the cards for each player, including the first card dealt,are displayed,along with the suitsymbol:spades ♠,clubs
♣, hearts ♥, or diamonds ♦.Each game will start
with a new,52-card deck, which is modeled on a real deck of cards.
. The card deck has 52 cards with no jokers.
The card deck is represented by a two-dimensional arrayof data-type character, where the first dimension represents
the suitand the second dimension represents
the card in the suit, such as the following.i.char CardDeck[4][13];At the start of each game,each elementofthe
two-dimensional arrayis initialized to a value of ” “, or
the “space” character.The deck has four suits,represented bythe following dimension indices.
.
i. ii. iii. Each suithas 13 cards:2, 3, 4, 5, 6, 7, 8,9 ,10, jack, queen,king,and ace. Each card in a suitis represented
2. by the following dimension indices.
. 2 card
i. 3 card ii. 4 card iii.5 card iv. 6 card v. 7 card vi. 8 card vii. 9 card viii. 10 card ix. jack x. queen xi. king xii. ace All the
number cards are worth their face value (i.e., a 3
of diamonds is worth 3).All face cards are worth 10. An ace is worth either 1 or 11. Your final-score calculation must
be able to handle this correctly for both the dealer
and each player. A random-number generator mustbe used to selectthe suitand the card in the suit.
. Once a card and suitare selected,the program should check ifthe value of that array elementis a “space.”
If the array setthe elementequal to an integer,identifying the dealer or the player. 1 2 3 4 If the array element!=
“space,” then the random-number and card-checking process should repeatuntil a “card” or an array elementis
selected thatOnce a card is drawn during a game,it cannotbe drawn again.When the program firststarts,it should
prompt
the user,asking ifhe or she wants to play a game of Blackjack or exit the program.If the user inputs to play the
game,the next decision should be 1,2, 3, or 4 players.At the
start of the game,the dealer and each player should be dealttwo cards.One of the dealer’s card’s value and suit
should notbe displayed.The number ofcards that the
dealer will draw during a game should be determined bya random-number generator thatwill return a value of 0, 1,
2, or 3 cards to be drawn.Each player may then draw
a card or hold.If, after drawing a card, any player or the dealer goes over a score of 21, he or she is notallowed to
draw any more cards during the game.Once a player
holds,he or she should notbe asked to draw a card again during the game.The game continues until one ofthe
following conditions occur:
. all players have declared hold;
all players and the dealer have gone over 21; a maximum offive cards total are held by any player at the end of a
round of card draws;or any combination ofthe above.
The displayshould show each player’s (and the dealer’s) hand and update the displayafter each round of card
draws.
spades ♠,clubs ♣, hearts ♥, and diamonds ♦
Example
Card 1
Card 2
Card 3
Card 4 Card 5
Dealer:
?
10♦
Player 1:
A♣
2♠
Player 2:
J♣
Q♥
Player 3:
3♦
8♣
At the end of a game,the displayshould be repeated,with the addition of win or lose and an updated balance.
Example
Card 1
Card 2
Card 3
Card 4
Card 5
Total
Stats
Dealer:
J♦
10♦
20
Lose
Player 1:
K♣
2♠
3. 5♥
1♦
5♦
23
Lose
Player 2:
J♣
Q♥
20
Lose
Player 3:
3♦
8♣
K♦
21
Win!
The program should then ask each player if he or she wants to play again or leave the game.The game continues
with a new round,as long as there is one player remaining.If there are no remaining players,the program should
exit.
COMP 220 iLab 2 Resistor Lab Reportand Source Code
Scenario and Summary
This lab requires you to create a multifile C++ projectin order to design and implementan object-oriented program
using a class to model the characteristics and function ofa resistor.
Deliverables
Submita single Notepad file containing the source code for Exercise 1 to the Dropboxfor Week 2. Your source code
should use proper indentation and be error free. Be sure that your lastname and the lab number are partof the file
name;see the following example:YourLastName_Lab1.txt.
Each program should include a commentsection thatincludes (ata minimum) your name,the lab and exercise
number,and a description ofwhatthe program accomplishes.Submita lab report(a Word document) containing the
following information to the Dropbox for Week 2. Include your name and the exercise number.Specification:Include a
brief description ofwhatthe program accomplishes,including its input,key processes,and output.Test Plan: Include
a brief description ofthe method you used to confirm that your program worked properly.If necessary,include a
clearly labeled table with test cases,predicted results,and actual results.Summaryand Conclusions:Include a
summaryof what the lab demonstrated and anyconclusions drawn from the testing ofthe lab program.Answers to
Lab Questions:Answer any and all lab questions included in the lab steps.
Summary:Write a statementsummarizing your predicted and actual output. Identify and explain any differences.
Conclusions:Write at leastone nontrivial paragraph that explains,in detail,either a significantproblem you had and
how you solved it or, if you had no significantproblems,something you learned by doing the exercise.
Each lab exercise should have a separate section in the lab-reportdocument.
Your lab grade will be based upon
the formatting of your source code;the use of meaningful identifiers;the extent of internal documentation;the degree
to which an exercises’ specifications are met;and the completeness ofyour lab report.
i L A B S T E P S
STEP 1: Create a Multifile Project
Objective: Create a C++ console application that will model the characteristics ofa resistor.
Create a multifile project.Create and add to the projectan h file containing the resistor-class definition.Create and
add to the projecta cpp file containing the implementation ofthe class -member functions.Create and add to the
projecta ccp file containing the main() function,which will instantiate a resistor objectand testits member functions.
STEP 2: Required Class Members
The resistor class will,atminimum,have members thatdo the following.
store the nominal resistance value of a resistor store the tolerance of a resistor initialize any and all nominal -
resistance values to correct, EIA, nonzero values that are greater than 0 and less than 1,000,000 ohms initialize any
and all resistance-tolerance values to correct, E12, E24, E48, or E96 resistance-tolerance values allow the nominal-
resistance and tolerance values ofa resistor objectto be changed by the user All member functions should have a
test message stating the name ofthe function. All the testmessages should be displayed or not displayed,depending
on the value of a Boolean variable declared in main().If the Boolean , displaythe message.If the Boolean , do not
4. displaythe message.
STEP 3: Program Operations
Function main() should instatiate two objects of class resistor.Function main() should displaythe current values of all
resistor objects.Function main() should also calculate and displaythe minimum and maximum in-tolerance
resistance values ofeach resistor objectfrom the resistor data members.Function main() should allow the user to
change the values of the nominal resistance and the resistor tolerance ofboth resistor objects,and it should also
correctly handle outof numeric-range input.Main() is also responsible for making sure thatthe user can successfully
enter only correct, EIA resistance and tolerance values.The user should be given the following data -entrychoices:
accept currentEIA values for resistance and tolerance;The function main() should displaythe new, modi fied values
of the resistor object,including the new min and max in-tolerance resistance values.The function main() should be
executed twice: once with the test messages displayed and once without.
STEP 4: Lab Questions
You are not required to copy the question text into your document,butall answers should be listed with the question
number they answer.
Listthe complete reference-source information for where you found the EIA standard resistor value and tolerance
information.How was this reference discovered and where? The constructor requires the initialization values for the
nominal resistance and the tolerance when an object is instantiated to be a correct E-series resistance and tolerance
combination.Describe how this was accomplished in your program design and implementation.In the lab, you were
required to provide mutator functions to change the nominal-resistance and tolerance values ofa resistor object.
Describe how this was accomplished so thatthe user could not enter an invalid nominal-resistance and E-series
tolerance combination.Describe how this process was differentand/or similar to how you implemented this validation
in the class constructor.
COMP 220 iLab 3 Bank Account Lab Reportand Source Code
This lab introduces you to writing a C++ program to implementthe conceptof class inheritance using differenttypes
of bank accounts as a model.In this lab, you will
create a base class,called CBankAccount,and two additional classes (each derived from CBankAccount), called
CSavingsAccountand CCheckingAccount.You will then
test the operations ofeach class in function main() to simulate the transactions ofboth a checking account and a
savings account.
Deliverables
Submita single Notepad file containing the source code for all the files of the lab to the Dropbox for Week 3. Your
source code should use proper indentation and be error free.
Be sure that your lastname and the lab number are part of the file name:for example,YourLastName_Lab3.txt.
Each program should include a commentsection thatincludes (minimally) your name,the lab and exercise number,
and a description ofwhat the program accomplishes.
Submita lab report (a Word document) containing the following information to the Dropbox for Week 3. Include your
name and the lab or lab-exercise number.Specification:
Include a brief description ofwhatthe program accomplishes,including its input,key processes,and output.Test
Plan: Include a briefdescription ofthe method you used to confirm that your program worked properly. If necessary,
include a clearly labeled table with testcases,predicted results,and actual results.Summaryand Conclusions:
Includea summaryof whatthe lab demonstrated and anyconclusions drawn from the testing ofthe lab program.
Provide a UML diagram showing the base and the derived
class relationships,access specifiers,data types, and function arguments.Answers to Lab Questions:Answer any
and all of the lab questions included in the lab steps.
Summary:Write a statementsummarizing your predicted and actual output. Identify and explain any differences.
Conclusions:Write at leastone nontrivial paragraph that explains,in detail,either a significantproblem you had and
how you solved it or, if you had no significantproblems,something you learned by doing the exercise.
Each lab exercise should have a separate section in the lab-reportdocument.
Your lab grade is based upon
the formatting of your source code;the use of meaningful identifiers;the extent of internal documentation;the degree
to which an exercises’ specifications are met;and the completeness ofyour lab report.
i L A B S T E P S
STEP 1: Create the Multifile Project and the Main (Base) Class
Create a new projectthat consists ofthe base class BankAccount.
The BankAccount class should contain,atminimum,the following members.
It should contain data members to store a bank customer’s balance and accountnumber.These should be of
different and appropriate data types. It should have function members thatdo the following:setthe accountnumber;
return the accountnumber;return the account balance;depositmoneyinto the account; and withdraw moneyfrom
5. the account.
STEP 2: Create the CheckingAccountClass Derived From the BankAccount Class
The class CheckingAccountshould contain, ata minimum,the following members.
It should contain a data member to keep track of the number of withdrawal transactions made on the account.
Whenever a withdrawal is made,this number should be incremented.Override the base class,withdraw -money
function, and add the capability to deduct transaction fees from an accountusing the following guidelines.
The checking accountis allowed three free transactions.For each successful withdrawal transaction pastthe three
free transactions,there will be a service fee of 50
cents per transaction.The service fee should be deducted from the accountbalance at the time the transaction is
made.If there are insufficientfunds in the accountbalance
to cover the withdrawal plus the service fee, the withdrawal should be denied.The function should return a value to
indicate whether the transaction succeeded or failed.Transaction fees should be deducted onlyfrom successful
transactions,butthe transaction countshould be incremented in either case.
STEP 3: Create the SavingsingAccountClass Derived From the BankAccount Class
The class CheckingAccountshould contain,ata minimum,the following members.
It should contain a data member to hold the daily interestrate. The daily interestrate can be calculated from a yearly
interestrate by dividing the annual rate by 365.
It should contain a data member to keep track of the number of days since the lasttransaction or balance inquiry.
This should be updated using a random-number
generator (reference Lab 1) that will return a value representing the number ofdays between 0 and 7, inclusive.We
will assume thatthis bank is open every day of the year.
It should contain a data member to hold the interestearned since the lasttransaction or balance inquiry. It should
contain a function member to set the annual interestrate.
Utilize the base-class functions for both withdrawal and depositoperations for the savings account.Override the
base-class-balance inquiryfunction to add calculating
and adding interestto the accountbased on the daily interestrate, the current balance of the account,and the
number ofdays since the lastbalance inquiry.
This should be called onlywhen a balance inquiryis made,notwhen a depositor withdrawal transaction or an
accountnumber inquiryis made.If there are insufficientfunds
in the accountbalance to cover a withdrawal,the withdrawal should be denied.The number of days since the last
transaction or balance inquiryand the interestcalculations should still be made.A value should be returned to
indicate whether a withdrawal transaction succeeded or failed.It should contain a function member to return the
interest
earned since the lasttransaction or balance inquiry. It should contain a function member to return the number of days
since the lasttransaction or balance inquiry.
STEP 4: Test Program Operation
All data-inputand data-displayoperations (cin and cout) should be done in the function main() testprogram.The test
program should create one checking accountand one savings accountwith initial balances of$100 each using the
functions defined in the class definitions.The testprogram should also assign a unique,five-digitaccount
number to each accountand assign an annual interestrate of 3% for the savings account.The testprogram should
then displaya menu that allows the user to select
which option is to be performed on which account, including the following.Make a depositand specify the amountto
a selected or an entered account. Make a with
drawal and specify the amountto a selected or an entered account. Return the balance of a selected or an entered
account. For deposittransactions,withdrawal
transactions,and balance inquiries,the updated balance and any fees charged or interestearned should also be
displayed.For the savings account,the number ofdays
since lasttransaction should be displayed.Exit the program.Each accountoperation should displaythe account
number and the account type.
Lab Questions
Please answer all the lab questions in the text file that is to be turned into the Dropbox. You are not required to copy
the question text into your document,butall answers
should be listed with the question number theyanswer.
Were any base-class functions called or overloaded in either of the derived clas ses? Ifso, listwhich class and which
function, and explain why they were either called or overloaded.Were any derived-class functions notexplicitly called
by the test program? Ifso, listwhich class and function,and explain why this was done.Which access
attribute was used for each of the classes derived from the base class? Whywas this access attribute chosen?
COMP 220 iLab 4 Composition Lab Reportand Source Code
6. This lab requires you to use C++ class composition to implementa single pole-filter design program.The program will
allow the user to specifyresistor and capacitor values and filter type.
Once all the user parameters are specified,the program will return the cutoff frequency values for the filter.
Composition maybe thoughtof as a has-a relationship for objects,as compared to inheritance,which maybe
described as an is-a relationship for objects.
You are required to use two componentclasses:one for a resistor objectand one for a capacitor object. You are then
to define and implementa filter class thatwill contain one objectof each the resistor and the capacitor classes in
order to create the filter and its characteristics.
The Resistor class created in the Week 2 iLab may be used both as the class definition for the resistor obj ectand as
a template or a guide for the capacitor-class definition.The lab also requires you to implementyour program in a
multiple-file projectand create both cpp and h files for each class defined.In addition,the program will have the
capacity to save all filter parameters to a text file and read previously designed filter parameters from a text file.
COMP 220 iLab 5 Lab Report and Source Code
Assignment:Lab 5 Pointers and Pointer Operators
Description:This lab will explore the use of pointers in several ways. Pointers will be used to dynamically allocate
memoryfor new class objects on demand from the user,and they will be used to access class-member functions.
Pointer arithmetic will be used to access and sortclass objects according to criteria explained in the lab.
Pointers are,essentially,address variables,or variables that hold as their value the address ofother variables.In
terms of memorymanagement,they are very powerful devices,and they more closelyand efficiently use the actual
internal hardware registers ofthe microprocessor thatthe program operates on.
Pointers also have the requirementthatthe pointer type mustbe of the same data type as the variable, or the data
that it points to or holds the address of.The power of pointers also hints atthe potential complexity of their use,which
is why this lab is focused almostentirelyon several different aspects and uses ofpointers.The lab also introduces
pointer arrays and pointers to pointers.
The Resistor class created in the Week 2 lab will be used as the class thatthe pointer operations will be used upon.
The lab also requires the use of accessor functions and static data members,which mayneed to be added to the
Resistor class definition and implementation.
COMP 220 iLab 6 Overloaded Operators Lab Report and Source Code
Assignment:Lab 6 Overloaded Operators
Description:This lab is to introduce students to the concept of operator overloading as member functions ofa class.
This will be done in the context of creating a class thatwill perform four basic mathematical operations on complex
numbers.
The C++ compiler has defined operators for all the arithmetic and assignmentoperations for its native data types,
such as integer,float, double,and so forth. However, for user-defined data types,such as classes and structures,
these operations are undefined.
C++ allows the programmer to create new definitions for these operators so thatthey can operate specificallyon
these user-defined data types.Which setof operators is actuallycalled and implemented is decided during the
compilation,and itis based on the data types of the operands involved in the operation.
The ability to define a new setof data-type, dependentoperations on existing operators,or functions,is called
operator overloading.
COMP 220 iLab 7 Polymorphism Lab Reportand Source Code
Assignment:Lab 7 Polymorphism
Description:This lab introduces students to the concepts of polymorphism,earlybinding,late binding,abstract
classes,and virtual class functions.This will be done in the context of performing calculations on basic geometrical
shapes.Polymorphism is a very powerful extension of inheritance,and by using pointers to the base class,itallows
access to derived class objects and their functions bas ed on the context that they are called in.
The lab will require the creation of a base geometric class,called Shape,and two sub classes,Circle and Rectangle,
that are derived public from the class Shape.From there,objects of both the Circle and the Rectangle classes will be
created, as will an array of pointers to the base class Shape.By using the instantiated objects and the object
pointers,both static and dynamic binding will be demonstrated.