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
14<br> Select the correct answer.<br> Which activity is a marketing technique?
Alex Ar [27]

Answer:

Growth Hacking.

Referral Programs.

Earned Media and PR.

Networking Events.

Search Engine Marketing.

Account Based Marketing and Retargeting.

Social Media Marketing.

Search Engine Optimization.

Explanation:

Growth Hacking.

Referral Programs.

Earned Media and PR.

Networking Events.

Search Engine Marketing.

Account Based Marketing and Retargeting.

Social Media Marketing.

Search Engine Optimization.

7 0
3 years ago
Part 2: Code the Program
OverLord2011 [107]

Answer:

# Name - Today's Date

# Description

def main():

    print("My favorite TV show is Mythbusters.")

    print("I like it because I learn a lot and they do crazy experiments.")

main()

(this is the best I can do since it's a specific result based on the choices you make, but I did the example code and you just need to fill it in with the necessary requirements. I also tested it on IDLE. )

8 0
3 years ago
1. To type a capital "C", you would use the ring finger of your left hand.
Anna11 [10]
False, keyboard, Hypertext Transfer Protocol
5 0
3 years ago
Read 2 more answers
I have no idea which one please help!
shutvik [7]

Answer:

i think its the second one

Explanation:

brainliest pls

6 0
2 years ago
Read 2 more answers
Implement the function first chars() that takes a list of strings as a parameter and prints to the screen the first character of
Fiesta28 [93]
Def firstChars( word ):
   if( word ): # make sure word has characters
       print( word[ 0 ] ) # print the first character (Python 3 syntax)
3 0
3 years ago
Other questions:
  • The system administrator in your office quits unexpectedly in the middle of the day. It's quickly apparent that he changed the s
    10·1 answer
  • ​_______ consists of the analysis​ tools, technologies, and processes by which marketers dig out meaningful patterns in big data
    7·1 answer
  • Read each scenario, and then select the best wireless device for the worker’s needs. A trucker is constantly on the road. He fre
    8·2 answers
  • What systemctl command configures a unit to start the next time the computer boots?
    10·1 answer
  • Who has access to the source code of proprietary software
    6·1 answer
  • i need to also do a algorithm where if the total is a even number 10 points are added to the score and if the total is odd then
    11·1 answer
  • What is the hexadecimal equivalent of the decimal number 256?
    11·1 answer
  • A single-user/single-tasking operating system allows only one user to perform one task at a time. A real-time operating system g
    13·1 answer
  • Write code that outputs variable numCats. End with a newline.
    6·1 answer
  • How to create drop down list in excel with multiple selections.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!