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
A penetration tester is experimenting with Network Mapper (Nmap) on a test network as a privileged user. The tester would like t
kondor19780726 [428]

The Network Mapper (Nmap) commands that would be useful on this test network are:

  1. nmap xxx.xxx.x.x -p
  2. nmap xxx.xxx.x.x -A

<h3>What is a penetration test?</h3>

A penetration test can be defined as a cybersecurity technique that simulates a cyber attack against an end user's computer system, so as to scan, identify, test and check for exploitable vulnerabilities in the following:

  • Operating system
  • Web software
  • Host device
  • Network

This ultimately implies that, a penetration test avails an tester the ability to exploit a weakness and potential security threats on a test network as a privileged user, during vulnerability assessments of the system.

<h3>The Network Mapper (Nmap) commands.</h3>

In this scenario, the Network Mapper (Nmap) commands that would be useful on this test network are:

  1. nmap xxx.xxx.x.x -p
  2. nmap xxx.xxx.x.x -A

Read more on penetration test here: brainly.com/question/25813524

6 0
2 years ago
Alguien me prestta una cuenta de osu!, porfa
Mariana [72]

Answer:

english please........

7 0
3 years ago
Which of the following is not a basic networking hardware component? Network interface card
RideAnS [48]

Answer:

Device Driver

Explanation:

All of the other options are physical and are something that you can physically touch. The device driver runs in software and allows the computer to communicate with the device that is attached.

4 0
3 years ago
You have $5 and earn $1.75 for each roll of wrapping paper you sell. Write an equation in two variables that represents the tota
qaws [65]

Answer:

A = 5 + 1.75r

Explanation:

Amount you have = $5

Earning per roll of wrapping paper = $1.75

Let

r = number of rolls of wrapping paper

A = Total amount earned

A = 5 + 1.75r

Equation that represents the total amount A (in dollars) you have after selling r rolls of wrapping paper is

A = 5 + 1.75r

3 0
3 years ago
The Danger zone around a robot is?
mojhsa [17]

maybe a EMP. tell me if im right

3 0
3 years ago
Read 2 more answers
Other questions:
  • _____ is when network managers deal with network breakdowns and immediate problems instead of performing tasks according to a we
    9·1 answer
  • A person who has a been exposed to technology at a young age is?
    8·1 answer
  • Match the challenge with the term or process that offers a solution.
    6·1 answer
  • Proper __ management is essenciales for meeting project deadlines​
    11·1 answer
  • Which of the following should you consider when
    5·1 answer
  • What is word processors​
    8·1 answer
  • What is the value of 8n when n= = 2?​
    13·1 answer
  • Richard needs to copy information from another slide presentation that uses a different design template. To ensure that the info
    10·1 answer
  • Can someone help me with python
    10·1 answer
  • After a Hacker has selects her target, performed reconnaissance on the potential target's network, and probed active Internet Ad
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!