Question

In: Computer Science

What data type should be used to store a count of items in a shopping cart?...

What data type should be used to store a count of items in a shopping cart?

Select one:

a. int

b. String

c. double

d. char

e. boolean

What data type should be used to store the dollar amount in a shopping cart?

Select one:

a. boolean

b. char

c. String

d. int

e. double

Solutions

Expert Solution

According to the problem statements above,

The answers are as follows,

What data type should be used to store a count of items in a shopping cart?

  • Answer: a) int
  • Explanation:
    • count of the items in cart must be int because, int represents single value which can be incrementable and precise while showing items count to the user in the cart.
    • The other options are FALSE
      • b) string is not incrementable
      • c) double will have float values which is useless to display the count
      • d) char stores only characters
      • e) boolean only stores TRUE/FALSE not integers

What data type should be used to store the dollar amount in a shopping cart?

  • Answer: e) double
  • Explanation:
    • double will store floating values as well. Dollars contains float values like $1.5 dollar, $3.4 dollars, etc
    • These are only accepted by doubldouble will have float values which is useless to display the counte data type.
    • The other options are FALSE
      • a) boolean only stores TRUE/FALSE not dollar values
      • b) char stores only characters
      • c) string is not incrementable
      • d) int can't store dollar values because it can't store float values

I hope the above explanation and information will help you out!

Thank you!


Related Solutions

Create a Python 3 program that acts as a grocery store shopping cart. 1. Create a...
Create a Python 3 program that acts as a grocery store shopping cart. 1. Create a class named GroceryItem. This class should contain: - an __init__ method that initializes the item’s name and price - a get_name method that returns the item’s name - a get_price method that returns the item’s price - a __str__ method that returns a string representation of that GroceryItem - an unimplemented method is_perishable Save this class in GroceryItem.py. 2. Create a subclass Perishable that...
Please write the UML sequence diagrams for a shopping cart: User Logs In Customer Adds Items...
Please write the UML sequence diagrams for a shopping cart: User Logs In Customer Adds Items to Shopping Cart Customer Reviews Product Details Customer Reviews/Updates Shopping Cart Customer Checks Out Seller Reviews/Updates Inventory Seller Adds New Product
1- The best choice for a data type used to store the grade to be recorded...
1- The best choice for a data type used to store the grade to be recorded at the end of the term for this course would be a(n) ____________. Valid values would be A, B, C, D, or F, no A- or B+ would be permitted, instead a single value will be stored. 2-   The best choice for a data type used to store the name of the city where you currently live would be in a(n) [a]. 3-The best...
You are in a department store shopping for an outfit and your budget is not what...
You are in a department store shopping for an outfit and your budget is not what you would like it to be. You have a pair of pants and two shirts that you absolutely love. You want both shirts but know you can't afford both, so you take them to the register to decide there. When you go to check out, you see it's one of your friends working there. You are casual friends and you haven't seen her in...
What properties and characteristists should any type of money possess in order to be used as...
What properties and characteristists should any type of money possess in order to be used as money?
A. what type of test should be used and why? B. Compose a null hypothesis to...
A. what type of test should be used and why? B. Compose a null hypothesis to accompany the test. Record both a generic version (through the use symbols) and an English version (using words) – for the generic version, it may be easier to insert an equation box into the word document and type via equation C. Compose an alternative hypothesis to accompany the test. Record both a generic version (through the use of symbols) and an English version (using...
What type of data mining model might be used by a retailer such as Kroger or...
What type of data mining model might be used by a retailer such as Kroger or Macy's to determine how to group customers into segments (such as "bargain shoppers", "fashion conscious", "trend setter")? a) a classification model b) a clustering model c) a regression model d) an association model
What types of items should you have multiple suppliers and the items for which you should...
What types of items should you have multiple suppliers and the items for which you should go with a reduced number of suppliers?
Determine what type of statistical test should be used to answer each of the questions below....
Determine what type of statistical test should be used to answer each of the questions below. (You will only use each response one time.) One Mean            One Proportion            Proportions from Dependent Samples            Two Independent Proportions            Two Independent Means            Means from Dependent Samples What proportion of Americans believe in climate change? Do college students change their view on climate change as they go through college? One...
Zelda Corp. makes pottery for people to store items in, Most of the indirect costs used...
Zelda Corp. makes pottery for people to store items in, Most of the indirect costs used to make these pots are associated with the manufacturing process. This means that Samantha Inc. allocates variable and fixed manufacturing overhead on the basis of machine hours. On January 1st, Zelda Corp. planned on making 4,500 clay pots for the month. They believed it would take 10,125 machine hours and 2,250 direct labor hours to make these pots. They believed their total manufacturing overhead...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT