1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vivado [14]
3 years ago
5

The major objective of this lab is to practice class and object-oriented programming (OOP), and separate files: 1. We will reuse

lab 6, a direct current simulator with extensions to let you practice OOP. Pay special attention to the difference between procedural programming and OOP. 2. This is the first time you break a program into several files such that you do not need to have all functions included in one program. The idea of breaking a program into several files has many benefits that will be explained in lecture notes and ZyBook reading assignment. It is NOT the purpose of this lab to train your logical thinking capability. We select a simple problem to help you fully understand OOP and separate files in an efficient manner.
Computers and Technology
1 answer:
vovangra [49]3 years ago
8 0

Answer:

Implementation of resistor.cpp

#include "resistor.h"

Ohms::Ohm()

{

// default constructor

voltage=0;

}

Ohms::Ohm( double x) // parameterised constructor

{

voltage = x; // voltage x set to the supply voltage in the private data field called voltage

}

Ohms:: setVoltage(double a)

{

voltage = a;// to set supply voltage in private data field called voltage

}

Ohms::setOneResistance( String s, double p)

{

cin>>p; //enter the resistance value

if(p<=0) // if resistance is less than or equals to 0

return false

else // if re

cin.getline(s);

}

Ohms::getVoltage()

{

return voltage; //return voltage of ckt

}

Ohms::getCurrent()

{

return current; //return current of ckt

}

Ohms:: getNode()

{

return resistors; //return resistors of ckt

}

Ohms::sumResist()

{

double tot_resist = accumulate(resistors.begin(),resistors.end(),0); //std::accumulate function for calculating sum //of vectors and following are the starting and ending points

return tot_resist;

}

Ohms::calcCurrent()

{

if(current <=0) // if current is less than or equal to 0

return false;

else   // if current is greater than 0

return true;

}

Ohms:: calcVoltageAcross()

{

if(voltage<=0) // if voltage is less than or equal to 0

return false;

else //if voltage greater than 0

return true;

}

Explanation:

in the case of main.cpp its simple just make a class object and remember to include resistors.cpp with it for which the second last picture describes the process precisely. (Hint: Use theunit test case functions in the main.cpp).

As you can see node is a structure consisting of member variables, followed by a class Ohms representing a DC circuit.

By looking at these pictures, it is needed to implement the main.cpp and resistor.cpp files. The user defined header file resistor.h already consists of all contents of Class Ohm, struct node. You don't need to modify it in anyway in such case.

You might be interested in
Please find one organization that has recently adopted virtualization and summarize their reasons for taking this approach. What
Mamont248 [21]

Answer:

Harley-Davidson Motor Company

Explanation:

Harley-Davidson produces and sells custom-made, touring as well as cruiser motorcycles that feature elegant styling,  modern innovative design, and high quality performance with the ability to customize to ones taste.  Harley-Davidson moved 95% of their x86 server workloads to virtualized environments utilizing VMware infrastructures as of 2018. They report to have being able to have higher system availability, effective and simple disaster recovery capabilities, improved operation efficiencies, and cloud-ready infrastructure. One of the major challenges of virtualization is Security, Virtual systems can easily get compromised.

8 0
3 years ago
What type of firestopping technology expands as much as 25 times in volume?
love history [14]
The answer is Intumescent. I am pretty sure this is right.
7 0
3 years ago
Write a 20 charecter poem! for points! :)
umka21 [38]
The sky was blue
Glistening clouds in the air
For the little boy had no clue
His mother sat him down on the warm chair

There’s some great news
Hitler took over
And they killed off the Jews
The little boy just wanted to show mom his 4 leaf clover
7 0
2 years ago
Read 2 more answers
Match the following
kakasveta [241]

Answer:

Eraser tool -removes the unwanted part of the drawing.

Row -horizontal space running from left to right.

Text -Primary component of a multimedia.

Drawing Area -Working are of ms point program.

I hope this helps!! Correct me plz if I'm wrong. If I'm right, could you mark me as brainliest?

8 0
3 years ago
Mad libs are activities that have a person provide various words, which are then used to complete a short story in unexpected(an
Vsevolod [243]

did you just put random a*s word together and expect us to know the ¨answer¨

5 0
3 years ago
Other questions:
  • If a database named Contacts has a table named tblEmployees and another database named Orders links to that tblEmployees table,
    8·1 answer
  • Write a Python function merge_dict that takes two dictionaries(d1, d2) as parameters, and returns a modified dictionary(d1) cons
    5·1 answer
  • Write a loop that inputs words until the user enters STOP. After each input, the program should number each entry and print in t
    12·1 answer
  • Amazon.com uses a customer profiling system whenever a customer visits its website. using this system, amazon can offer products
    6·1 answer
  • Please as soon as possible
    13·1 answer
  • Which image file format is the best format to use for photographs on the Web
    15·1 answer
  • Lee has changed the style of his table to make the header row stand out. Next, he wants to center the text in the header row and
    11·2 answers
  • A non-profit organization decides to use an accounting software solution designed for non-profits. The solution is hosted on a c
    11·1 answer
  • B) The company's chief financial officer recognizes the need for an upgrade to the smart watches, but does not understand why th
    8·1 answer
  • Project stem test 3 answers
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!