Question

AaBbCcDc AaBbCcDc AaBbCr AaBbCct AaB AaBb NormalNo Spac.. Heading 1 Heading 2 Title Subtiti Paragraph Styles 3. Write a method called sumRange that accepts two integer parameters that represent a range. if the first parameter is greater than the second, throw an Arithmetic Exception. Otherwise, the method should return the sum of the integers in that range (inclusive). 4. Write an if/else statement in tenary format that compares the value of two variables, lastyrTaxes and estimatedTaxes, and modifies the value of a boolean variable oweMoney appropriately as follows. oweMoney should be true when lastyrTaxes is lower than estimatedTaxes and false when that is not the case.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

According to HomeworkLib guidelines i have to solve first question only.

3.

#include <iostream>

using namespace std;

int sumRange (int low, int high); // function prototype

int main() {

int first,second; // variable declaration

try {

cout <<"Enter first number: ";

cin>>first; // Accept first number

cout <<"Enter second number: ";

cin>>second; // Accept second number

cout<<"Sum of the integers is "<<sumRange(first,second)<<endl; // calling function

}

catch (const char* msg) // If an error occur

{

cerr << msg << endl;

}

}

int sumRange (int low, int high) // called function

{

int sum = 0;

if(low>high) // Check low is greater than high

{

throw "first number must less than second number"; // throw an exception

}

for (int count=low; count <= high; count++)

sum += count; // calculate the sum in the range

return sum; // return sum

}

Output:

gcc version 4.6.3 Enter first number: 2 Enter second number: Sum of the integers is 14

Add a comment
Know the answer?
Add Answer to:
AaBbCcDc AaBbCcDc AaBbCr AaBbCct AaB AaBb NormalNo Spac.. Heading 1 Heading 2 Title Subtiti Paragraph Styles...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SALT AaBbCcDc AaBbCcDc AaBb C AaBbccc AaB 1 No Spac... Heading 1 Heading 2 1 Normal...

    SALT AaBbCcDc AaBbCcDc AaBb C AaBbccc AaB 1 No Spac... Heading 1 Heading 2 1 Normal Title Paragraph Styles In an experiment, 50.0 mL of a solution of (CH.CH:).NH was titrated with 0.782 M HNO.. the initial pH was 12.98, the pH at the / equivalence point was 10.98, and the pH at the equivalence point was 5.80 what is the molarity of the (CH.CH.) NH I

  • please help AaBbCcDc AaBbCcDc AaBb 1 Normal T No Spac... Heading 1 AaBbc Heading 2 A...

    please help AaBbCcDc AaBbCcDc AaBb 1 Normal T No Spac... Heading 1 AaBbc Heading 2 A ==== E, C, E, Styles Paragraph 6. What happens to the SML graph if inflation changes or if risk aversion changes? How will this impact the required returns of stocks with a beta of 0.5, 1.0, or 1.5, respectively? (You do not need to provide calculations on this, but explain what happens.) 5 points

  • AaBbcDc AaBbCr AaBbCct AaB AaB Normal 1 No Spac.. Heading) Heading 2 Tubti Subtle Em.. Emphasis...

    AaBbcDc AaBbCr AaBbCct AaB AaB Normal 1 No Spac.. Heading) Heading 2 Tubti Subtle Em.. Emphasis Intense EStiong Styles IN-CLASS/ONLINE CASE STUDY CHAPTER 26-Pharyngitis Patient Profile C.H., a 23-year-old female college student, comes to the university health clinic complaining of a "sore throat and headache" that started the previous day. She had tried over-the-counter medicine with minimal relief. Subjective Data . Denies any nausea, vomiting, and diarrhea . Has an infrequent, nonproductive cough Objective Data Blood pressure 130/68, pulse 86,...

  • AaBbCcDc AaBbCcDc AaBbc 1 Normal 1 No Spac... Heading 1 EEEEE Paragraph Styles PICCOT question In...

    AaBbCcDc AaBbCcDc AaBbc 1 Normal 1 No Spac... Heading 1 EEEEE Paragraph Styles PICCOT question In prostate cancer patients with a Gleason score of 6 or above (P), how does radiation (1) compared to having a prostatectomy(C) on clinical response rate and overall survival (O). 1:What method would be use to purpose the research topic above 2:What sample would be use to purpose the research topic above 3: How would you conduct a different research study to impact the issue...

  • Aa A D-A E E ALT ED- AaBbCcDc AaBbCcDc AaBb 1 Normal 1 No Spac... Heading...

    Aa A D-A E E ALT ED- AaBbCcDc AaBbCcDc AaBb 1 Normal 1 No Spac... Heading 1 AaBbc A Heading 2 Paragraph Styles 1 Identify several roles in nursing that interest you and that also require a baccalaureate degree R:As a new baccalaureate nurse, how can you best prepare for your new role as a BSN- prepared nurse? 3: How will professional certification increase your chances of being selected for the new role for which you applied? 4: What new...

  • AaBbccDc AaBCC AaBbCcc AC 1 No Spac... Heading 1 Heading 2 Titl 1 Normal Paragraph Styles...

    AaBbccDc AaBCC AaBbCcc AC 1 No Spac... Heading 1 Heading 2 Titl 1 Normal Paragraph Styles In an experiment, 50.0 mL of a solution of (CH.CH)NH was titrated with 0.782 M HNO.. the initial pH was 12.98, the pH at the 12 equivalence point was 10.98, and the pH at the equivalence point was 5.80 what is the molarity of the (CH.CH).NH HO

  • AaBbccdc AabbCcDc AaBbc Aabbcc Aal 1 No Spac... Heading 1 Heading 2 aly - A T...

    AaBbccdc AabbCcDc AaBbc Aabbcc Aal 1 No Spac... Heading 1 Heading 2 aly - A T Normal Title Paragraph Styles Q2. Mr. Marwan and Munir both are having manufacturing plant in "Salalah Industrial Special Zone". Both supplies raw material to "Amada Bakery" to produce bakery products. Mr. Marwan use marginal costing method and Mr. Munir use absorption costing methods for valuation of their stocks and calculating profit margin. You have to write comparative impact of both the methods of costing...

  • 1 Normal AaBbccl 1 No Spac... Heading 1 Heading 2 Title Paragraph Styles Aqueous solutions of...

    1 Normal AaBbccl 1 No Spac... Heading 1 Heading 2 Title Paragraph Styles Aqueous solutions of sodium phosphate and calcium chloride react Procedure: 1. Obtain a well plate 2. Add several drops of sodium phosphate and several drops of calcium chloride to a single well. • What do you observe? (2) • Write a balanced chemical reaction including states of matter (12) Na3PO4 +CaCl2 → Ca3(PO4)2 + Naci • Identify the reaction type and explain your reasoning (2) Double Replacement....

  • ou want to do Cet AaBbcel AaBbC AaBboct AaB AaBbCct AoBbocD Aab mal 1No Spac.. Heading...

    ou want to do Cet AaBbcel AaBbC AaBboct AaB AaBbCct AoBbocD Aab mal 1No Spac.. Heading 1 Heading 2 TitleSubtile Subtle Em... mphasis Intense E. Strong Quote Styles Radio Waves Through a Wall H&B model radio waves propagating through a wall as a sequence of three transmission lines as shown in the two figures below. In most practical cases Zs Zs Medin 08 07 06 0.5 04 03 02 Parallel Pol 0 500 1000 1500 2000 2500 Frequency in MHz...

  • 11 AaBbCcDc AaBbCcDc AaBb C 1 Normal 1 No Spac... Heading 1 Editing agraph Styles NUR...

    11 AaBbCcDc AaBbCcDc AaBb C 1 Normal 1 No Spac... Heading 1 Editing agraph Styles NUR 201 Case Study This assignment is worth 10% percent of your grade Please add your possible solution in three to four sentences. Please be grammatically correct. If you cite, please reference in APA Case Study #2: Right Drug, Wrong Patient The Medication Error A nurse at working at a nursing home transcribed a resident's medication order on a different person's chart. Her colleague also...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT