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
natka813 [3]
3 years ago
14

Assume the following variables are defined: int age; double pay; char section; write a single c instatement that will read input

into each of these variables. in c ++
Computers and Technology
1 answer:
JulsSmile [24]3 years ago
5 0

Answer:

scanf("%d %lf %c", &age, &pay, &section);

Explanation:

To read the value in c program, the instruction scanf is used.

To read the integer value, use the %d format specifier in the scanf and corresponding variable name age with ampersand operator.

To read the double value, use the %lf format specifier in the scanf and corresponding variable name pay with ampersand operator.

To read the character value, use the %c format specifier in the scanf and corresponding variable name section with ampersand operator.

You might be interested in
Which group scope can be used to assign permissions to resources only in the domain in which the group is created
sleet_krkn [62]

Answer: Domain local group

Explanation:

Domain Local Group is a form of group in a Windows Server network in Microsoft which is used by an administrator to assign permissions to the resources that are in same domain.

Their scope is strictly restricted to their particular domain. It should also be noted that they've open membership which simply implies that members form other domain can be added to them. One has to first know the users that have identical job responsibilities in order to use the domain local group, then identify the network resources that are similar which users want to access.

8 0
3 years ago
Fill in the function shopSmart(orders,shops) in shopSmart.py, which takes an orderList (like the kind passed in to FruitShop.get
ira [324]

Answer:

def shopSmart(orderList, fruitShops):  #function definition

   shop = fruitShops[0] #sets the shop to first item of fruitShops list

   leastAmount = shop.getPriceOfOrder(orderList)  #passes the orderList to getPriceOfOrder method which returns the total cost and saves it to leastAmount

   for fruitshop in fruitShops[1:]:  #iterates through the shops in fruitShops list

    cost = fruitshop.getPriceOfOrder(orderList)  #checks each cost or order using getPriceOfOrder method and passing orderList to it

    if cost < leastAmount:  #checks where order costs the least amount in total

     shop = fruitshop  #sets the FruitShop where order costs the least amount in total

     leastAmount = cost  #sets that minimum of order cost to leastAmount

   return shop #returns the FruitShop where order costs the least amount in total

Explanation:

Here are the getPriceOfOrder() and getName()) methods that is used in the above method.

def getPriceOfOrder(self, orderList):        

       totalCost = 0.0              

       for fruit, numPounds in orderList:

           costPerPound = self.getCostPerPound(fruit)

           if costPerPound != None:

               totalCost += numPounds * costPerPound

       return totalCost

def getName(self):

       return self.name

Here is the main program:

orders = [('apples',1.0), ('oranges',3.0)]

dir1 = {'apples': 2.0, 'oranges':1.0}

shop1 =  shop.FruitShop('shop1',dir1)

dir2 = {'apples': 1.0, 'oranges': 5.0}

shop2 = shop.FruitShop('shop2',dir2)

shops = [shop1, shop2]

print("For orders ", orders, ", the best shop is", shopSmart(orders, shops).getName())

orders = [('apples',3.0)]

print("For orders: ", orders, ", the best shop is", shopSmart(orders, shops).getName())

Notice that the statement:

print("For orders ", orders, ", the best shop is", shopSmart(orders, shops).getName())

has orders list which is:

[('apples',1.0), ('oranges',3.0)]

and it has shops which is a list containing two shops:

shops = [shop1, shop2]

It also calls method shopSmart by passing orders and these two shops to get the shop where the order costs the least amount in total. It has a for loop that iterates through each shop and check the orders using getPriceOfOrder method to determine at which shop the order costs the least amount in total. When the least amount is found it is set to the variable leastAmount and the shop corresponding to this order which has least amount is set to shop variable. At the end this shop is returned by the function. getName() method is used in the main program to get the name of the shop with least amount of order cost. So above print statement gives the following output:

For orders  [('apples', 1.0), ('oranges', 3.0)] , the best shop is shop1    

The entire program along with its output is attached.                                

8 0
4 years ago
Write code which takes a user input of a String and an integer. The code should print each letter of the String the number of ti
il63 [147K]

import java.util.*;

public class myClass {

public static void main(String args[]) {

Scanner scan = new Scanner(System.in);

System.out.print("Input a String: ");

String str = scan.nextLine();

System.out.print("Input an integer: ");

int num = scan.nextInt();

for(int i=str.length()-1; i>=0; i--) {

for(int j=0; j<num; j++) {

System.out.print(str.charAt(i));

}

}

}

}

8 0
3 years ago
Upon combustion a .8009 g sample of a compound containing only carbon hydrogen and oxygen produced 1.6004 g of CO2 and .6551 g o
Amiraneli [1.4K]
I believe the answer would be 0.0364 moles since 1.6004 / 44.01 (CO2) AND 0.6551 / 18.01 (H20) both equal that.

Let me know if this is correct or not! <3
5 0
4 years ago
A concave lens is also called a diverging lens. please select the best answer from the choices provided t f
nlexa [21]

The answer is true because a concave lens is also called a diverging lens.


5 0
3 years ago
Other questions:
  • Array testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full cre
    10·1 answer
  • Identify which portion of the below host IP addresses are invalid and explain why it is invalid. Hint: If you aren't sure, conve
    12·1 answer
  • An example of software is
    9·2 answers
  • Edmund wants to visit his university's website. Which software application would he use?
    14·1 answer
  • What problem does chlorofluorocarbon (CFC) create?
    5·1 answer
  • Given an integer variable count, write a statement that displays the value of count on the screen. Do not display anything else
    11·1 answer
  • Gabe Kelp is a fourteen-year-old goalie for the Soaring Eagles soccer team. He and his teammates are each creating a screen name
    11·1 answer
  • In which of the following work situations would word processing software be most appropriate to make the task easier?
    6·1 answer
  • Use the drop-down menus
    9·2 answers
  • The main work area of the computer is the
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!