Question

In: Computer Science

In congress, members typically vote electronically. A bill requires a simple majority of “Yea” votes (more...

In congress, members typically vote electronically. A bill requires a simple majority of
“Yea” votes (more than 50%) to pass. There are 435 members in the House of Represen-
tatives and 100 in the Senate. Write a function that declares two parameters: the number
of “Yea” votes, and which house is voting (the House of Representatives or the Senate)
and returns the value True if the bill received enough votes to pass, and False if it did not.

Solutions

Expert Solution

// C++ Code:-

#include<iostream>
using namespace std;

// function that declares two parameters: the number
// of “Yea” votes, and which house is voting (the House of Representatives or
// the Senate) and returns the value True if the bill received enough votes to
// pass, and False if it did not.

bool check_bill_majority(int vote,int house)
{
// 1 means house of representative and 50% of 435 = 217.5 . Here we consider
// 218 .

if(house==1)
{
if(vote>=218)
return true;
else
return false;
}
  
// 2 means house of Senate and 50% of 100 is 50 and votes must be more than 50.
else if(house == 2)
{
if(vote>50)
return true;
else
return false;
}
}
int main()
{
// In this program we input from user the house selection and number of vote.
// user input 1 for house of representative or 2 for Senate.

int house,vote;
cout<<"Enter House : ";
cin>>house;
  
// User input the number of 'Yea' vote.
cout<<"Enter Total number of votes : ";
cin>>vote;
  
// Calling function to check whether the bill is pass or not.
bool flag = check_bill_majority(vote,house);
  
// If flag is true means bill is pass.
if(flag)
cout<<"Bill is Successfully passed."<<endl;
else
cout<<"Bill is not passed"<<endl;
return 0;
}


Related Solutions

Should members of Congress (1) vote their consciences; OR (2) follow the will of the people...
Should members of Congress (1) vote their consciences; OR (2) follow the will of the people who elected them to office; OR (3) follow the voting recommendations of the leaders of their political party? Explain your answer
1. Suppose you and your partner typically vote oppositely in elections so that their your votes...
1. Suppose you and your partner typically vote oppositely in elections so that their your votes “cancel each other out.” Each one of you gains 2 units of happiness from a vote for your positions (and lose two units of happiness from a vote against their positions). However, the cost of voting for each one of you is 1 unit of happiness. Using a diagram (2X2 table) to represent a game in which you two choose whether to vote or...
answer is short essay. should members of congress vote their own conscience or follow the will...
answer is short essay. should members of congress vote their own conscience or follow the will of the people who elected them into office? explain your answer in relation to the delegate/trustee split in political representation.
Consider an m-member jury that requires n or more votes to convict a defendant. Let p...
Consider an m-member jury that requires n or more votes to convict a defendant. Let p be the probability that a juror votes a guilty person innocent and let q be the probability that a juror votes an innocent person guilty, 0<p<1, 0<q<1. Assuming that r is the fraction of guilty defendants and that jurors vote independently, what is (a) the probability a defendant is convicted? (b) the probability a defendant is convicted when n=9, m=12, p=.25, q=.2, and r=5/6?...
Research shows that when congressional districts are redrawn to include more elderly people, members of Congress...
Research shows that when congressional districts are redrawn to include more elderly people, members of Congress become more likely to take pro-elderly positions in congressional votes. Explain why the median voter model predicts this outcome
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT