QUESTION 3 (30 Marks) Construct A C++ Program Usin...

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

 Home Study tools  My courses  My books My folder Career Life 

Find solutions for your homework Search

home / study / engineering / computer science / computer science questions and answers / question 3 [30 marks] construct a c++ program using class…

Question: QUESTION 3 [30 Marks] Construct a C++ program using class th… Post a question
Answers from our experts for your tough
homework questions
(1 bookmark)
#1 Malaysia:
Enter question W Air Freshener

W Fragrance Open

Continue to post
20 questions remaining

#1 Malaysia: W
Air Freshener

My Textbook Solutions

Microelectr... Microelectr... Fluid...

4th Edition 4th Edition 2nd Edition


Show transcribed image text
View all solutions

Expert Answer

Anonymous answered this


Was this answer helpful? 0 0
95 answers

Code

#include<bits/stdc++.h>
using namespace std;
class circuit{
public:
int R1;
int R2;
int R3;

circuit(int R1,int R2,int R3){//parameterized constructor to input the values of resistors


this->R1=R1;
this->R2=R2;
this->R3=R3;
}

void current(){
int V=30;
//calculating and printong the current through each resistors
cout<<"Curent through R1 is "<<(V*1.0)/R1<<"A, through R2 is "<<(V*1.0)/R2<<"A, and through R3 is "
<<(V*1.0)/R3<<"A"<<endl;
}

};

int main(){
int R1,R2,R3;
cout<<"Enter the values of R1, R2 and R3: ";
cin>>R1>>R2>>R3;//input resistors value
circuit c(R1,R2,R3); //creating an object of circuit class i.e c
c.current(); //call the current function of circuit class
}

Output-

Hide comments (1) 

Comments
Anonymous posted 2 weeks ago

Hi, if you found it is helpful then please upvote the answer 😊

Leave a comment

Questions viewed by other students

Q: Question 1 [40 Points]: Read carefully and then answer the following questions Fatima works as a Quality Assurance
Engineer at a large electronics company. She is responsible for the nal testing of her company's servers and is part of a
team which decides when new products will be shipped to distributors for sale. Fatima's company has a contract with
another company which makes...

A: See answer 100% (1 rating)

Q: QUESTION 3 [30 Marks] Construct a C++ program using class that has data member and member function to compute
the current through each resistor for circuit shown in Figure 2. R3 WWW R2 www R1 WW V Figure 2 Take the voltage, V,
equal to 30 volts. Use R1 = 10, 20, and 30 N; R2 = 40, 60, and 80 ; and R3 = 100, 120, and 130 N. (30 Marks)

A: See answer

Show more 

COMPANY LEGAL & POLICIES CHEGG PRODUCTS AND SERVICES CHEGG NETWORK CUSTOMER SERVICE

About Chegg Advertising Choices Cheap Textbooks Chegg Math Solver EasyBib Customer Service
Chegg For Good Cookie Notice Chegg Coupon Mobile Apps Internships.com Give Us Feedback
College Marketing General Policies Chegg Play Sell Textbooks Thinkful Manage Subscription
Corporate Development Intellectual Property Rights Chegg Study Help Solutions Manual
Investor Relations Terms of Use College Textbooks Study 101
Jobs Global Privacy Policy eTextbooks Textbook Rental
Join Our Affiliate Program DO NOT SELL MY INFO Flashcards Used Textbooks
Media Center Honor Code Learn Digital Access Codes
Site Map Honor Shield Uversity Chegg Life
Chegg Writing

© 2003-2021 Chegg Inc. All rights reserved.

You might also like