answer.
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
juin [17]
2 years ago
15

Write a program that takes a single integer input from the user and stores it in a variable. Your program should increase the va

lue of this variable by one three times, printing "number is now " followed by its value each time, then decrease it by one three times, again printing "number is now " and the value each time
Computers and Technology
1 answer:
Allushta [10]2 years ago
8 0

Answer:

Question is answered using python:

num = int(input("User Input: "))

for i in range(3):

    num = num+1

    print("Number is now "+str(num))

for i in range(3):

    num = num-1

    print("Number is now "+str(num))

Explanation:

This line prompts user for input

num = int(input("User Input: "))

The following iterates from 1 to 3

for i in range(3):

This increments user input each time

    num = num+1

This prints the value of num after increment

    print("Number is now "+str(num))

The following iterates from 1 to 3

for i in range(3):

This decrements the value of num

    num = num-1

This prints the value of num after decrement

    print("Number is now "+str(num))

You might be interested in
Susan is creating a spreadsheet, and she needs to enter the months of the year in column A. Susan should _____.
AysviL [449]
Enter January in A1 hold mouse in bottom right hand corner of cell. Hold mouse button down and drag the mouse. Excel will populate the months of the year
3 0
1 year ago
Read 2 more answers
What is the name of the item that supplies the exact or near exact voltage at the required wattage to all of the circuitry insid
gizmo_the_mogwai [7]

Answer:

It's the <u><em>power supply</em></u>

Explanation:

The power supply is what essentially enables the computer to operate. It is able to do that by converting the incoming alternating current (AC) to direct current (DC) at the correct wattage rating that is required by the computer to function. The power supply is a metal box that is generally placed in the corner of the case.

4 0
1 year ago
Redo Programming Exercise 16 of Chapter 4 so that all the named constants are defined in a namespace royaltyRates. PLEASE DONT F
Komok [63]

Answer:

Code is given below and output is attached in the diagram:

Explanation:

//Use this header file while using visual studio.

#include "stdafx.h"

//Include the required header files.

#include<iostream>

//Use the standard naming convention.

using namespace std;

//Define a namespace royaltyRates.

namespace royaltyRates

{

    //Declare and initialize required named constants.

    const double PAY_ON_DELIVERY_OF_NOVAL = 5000;

    const double PAY_ON_PUBLISH_OF_NOVAL = 20000;

    const double PER_ON_NET_PRICE_SECOND_OPTION =

    0.125;

    const double PER_ON_NET_PRICE_FIRST_4000 = 0.1;

    const double PER_ON_NET_PRICE_OVER_4000 = 0.14;

};

//Start the execution of main() method.

int main()

{

    //Declare and initialize the required variables

    //which are going to be used to calculate

    //royalities under each option.

    float net_price;

    int num_copies;

    float royaltyUnderOption1, royaltyUnderOption2,

    royaltyUnderOption3;

    royaltyUnderOption1 = royaltyUnderOption2

    = royaltyUnderOption3 = 0;

    //Prompt the user to enter the net price of each

    //novel.

    cout << "Please enter the net price for each ";

    cout << "copy of the novel : ";

    cin >> net_price;

    //Prompt the user to enter the estimated number

    //of copies of the novels to be sold.

    cout << "Please enter the estimated number ";

    cout << "of copies to be sold : ";

    cin >> num_copies;

    //Display the required details and royalty

    //calculated under option 1.

    cout << "\n*** Option 1: ****" << endl;

    cout << "Net price of each novel: $" << net_price;

    cout << endl;

    cout << "Estimated number of copies to be sold ";

    cout << "is: " << num_copies << endl;

    cout << "$";

    cout << royaltyRates::PAY_ON_DELIVERY_OF_NOVAL;

    cout << " is paid to author for the delivery of ";

    cout << "the final manuscript and $";

    cout << royaltyRates::PAY_ON_PUBLISH_OF_NOVAL;

    cout << " is paid for the publication of ";

    cout << "novel." << endl;

    royaltyUnderOption1 =

    royaltyRates::PAY_ON_DELIVERY_OF_NOVAL +

    royaltyRates::PAY_ON_PUBLISH_OF_NOVAL;

    cout << "Total amount of royalty under option 1 ";

    cout << "is $" << royaltyUnderOption1 << endl;

    //Display the required details and royalty

    //calculated under option 2.

    cout << "\n*** Option 2: ****" << endl;

    cout << "Net price of each novel: $";

    cout << net_price << endl;

    cout << "Estimated number of copies to be sold ";

    cout << "is: " << num_copies << endl;

    royaltyUnderOption2 =

   (royaltyRates::PER_ON_NET_PRICE_SECOND_OPTION *

    net_price)* num_copies;

    cout << "Total amount of royalty under option 2 ";

    cout << "is $" << royaltyUnderOption2 << endl;

    //Display the required details and royalty

    //calculated under option 3.

    cout << "\n*** Option 3: ****" << endl;

    cout << "Net price of each novel: $" << net_price;

    cout << endl;

    cout << "Estimated number of copies to be sold ";

    cout << "is: " << num_copies << endl;

    //If the number of copies is greater than 4000.

    if (num_copies > 4000)

    {

         //Total amount of royalty will be 10% of net

         //price of first 4000 copies and 14 % of net

         //price of copies sold over 4000.

         royaltyUnderOption3 =

         (royaltyRates::PER_ON_NET_PRICE_FIRST_4000 *

         net_price) * 4000 +

         (royaltyRates::PER_ON_NET_PRICE_OVER_4000 *

         net_price) * (num_copies - 4000);

    }

    //Otherwise,

    else

    {

         //Total amount of royalty will be 10% of net

         //price of first 4000 copies.

         royaltyUnderOption3 =

         (royaltyRates::PER_ON_NET_PRICE_FIRST_4000 *

         net_price) * num_copies;

    }

    cout << "Total amount of royalty under option 3 ";

    cout << "is $" << royaltyUnderOption3 << endl;

    //If the royalty under option 1 is greater than

    //royalty under option 2 and 3, then option 1 is

    //best option.

    if (royaltyUnderOption1 > royaltyUnderOption2 &&

    royaltyUnderOption1 > royaltyUnderOption3)

    {

         cout << "\nOption 1 is the best option that ";

         cout << "author can choose." << endl;

    }

    //If the royalty under option 2 is greater than

    //royalty under option 1 and 3, then option 2 is

    //best option.

    else if (royaltyUnderOption2 > royaltyUnderOption1

    && royaltyUnderOption2 > royaltyUnderOption3)

    {

         cout << "\nOption 2 is the best option that ";

         cout << "author can choose." << endl;

    }

    //If the royalty under option 3 is greater than

    //royalty under option 1 and 2, then option 3 is

    //best option.

    else

    {

         cout << "\nOption 3 is the best option that ";

         cout << "author can choose." << endl;

    }

    //Use this command while using visual studio.

    system("pause");

    return 0;

}

5 0
2 years ago
In an ISDN connection, what amount of throughput did a single B channel provide?
Flura [38]

Answer:

64 Kbps

Explanation:

ISDN stands for Integrated Services Digital Network. It makes use of two types of channels:

B type : which is used for carrying data/voice

D type : which carries control and signalling information.

ISDN supports two different service levels:

  • Basic Rate Interface (BRI) - home and small users
  • Primary Rate Interface(PRI) - larger enterprise scenarios

Both BRI and PRI make use of set of B and D type channels for data transfer.

Each B channel or Bearer channel has a throughput of 64 Kbps whereas D channel has a throughput of 16 Kbps.

3 0
2 years ago
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the g
I am Lyosha [343]

Answer:

#program in Python.

#function to calculate driving cost

def driving_cost(d_miles, m_per_gallon, doll_per_gallon):

   #calculate cost and return the value

   return (d_miles / m_per_gallon) * doll_per_gallon

#read the miles per gallon  

m_per_gallon = float(input("Enter car's miles/gallon:"))

#read dollars per gallon

doll_per_gallon = float(input("Enter gas dollars/gallon:"))

#call function to find cost for 10 miles

print('%0.2f' % driving_cost(10, m_per_gallon, doll_per_gallon))

#call function to find cost for 50 miles

print('%0.2f' % driving_cost(50, m_per_gallon, doll_per_gallon))

#call function to find cost for 400 miles

print('%0.2f' % driving_cost(400, m_per_gallon, doll_per_gallon))

Explanation:

Read the value of miles per gallon and assign it to variable "m_per_gallon". Then read dollars per gallon from user and assign it to variable "doll_per_gallon". Call the function driving_cost() with parameter miles, m_per_gallon and doll_per_gallon. This function will find the cost of driving and return the cost.Call function for  10, 50 and 400 miles.

Output:

Enter car's miles/gallon:20                                                                                                

Enter gas dollars/gallon:3.1599                                                                                            

1.58                                                                                                                      

7.90                                                                                                                      

63.20

5 0
1 year ago
Read 2 more answers
Other questions:
  • The most commonly used method to connect to a WAN is through the telephone system. To do so, what piece of equipment would you r
    13·2 answers
  • Which feature of a typical professional networking site helps users add professional details to their profile ?
    9·2 answers
  • What is a commonly publicized password sql injection string?
    10·1 answer
  • Manny is a personal trainer. He gives his client an endurance test each week. He would like to illustrate how much the client ha
    7·2 answers
  • Survey Q, Non-scoring: What role are you playing in your team?
    5·2 answers
  • An electronics store purchased a CD player at a wholesale price of $60 and then sold it at a 40 percent discount off the origina
    13·1 answer
  • Consider the following relation:CAR_SALE(Car#, Date_sold, Salesperson#, Commission%, Discount_amt)Assume that a car may be sold
    12·1 answer
  • A program is loaded into _________ while it is being processed on the computer and when the program is not running it is stored
    15·2 answers
  • Write a class named Employee that has private data members for an employee's name, ID_number, salary, and email_address. It shou
    7·1 answer
  • John downloaded the manual for his TV, called manual-of-tv.pdf, from the manufacturer's website. After he clicked twice on the d
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!