Write a program that prompts the user for a positive integer

Assignment Help Programming Languages
Reference no: EM131003002

Question 1.

Write a program that prompts the user for a positive integer greater than 1. The program should then output either "prime" if the given number is a prime or "composite" otherwise. Recall that an integer is prime if and only if its only divisors are 1 and itself.

Question 2.

  1. Your program should simulate a checkout counter.  It should work like the following example:

<Program> Welcome to the checkout counter!  How many items are you purchasing today?

<User> 3 (user presses Enter key)

<Program> Please enter the name of product 1:

<User> chicken (user presses Enter key)

<Program> And how much does chicken cost?  

<User> 3.50 (user presses Enter key)

<Program> Please enter the name of product 2:  

<User> chips (user presses Enter key)

<Program> And how much does chips cost?  

<User> 1.25 (user presses Enter key)

<Program> Please enter the name of product 3: 

<User> gum (user presses Enter key)

<Program> And how much does gum cost?

<User> .99 (user presses Enter key)

<Program>

Your order was:

chicken $3.50

chips $1.25

gum $.99

Your subtotal comes to $5.74.  With 9% sales tax, your total is $6.19.

Please enter cash amount:

<User> 20.00 (user presses Enter key)

<Program>

I owe you back $13.81. 

Thank you for shopping with us!

Hint: You will need two separate lists for question 2.

Reference no: EM131003002

Questions Cloud

Should companies have a big role in improving the world : Should companies have a big role in improving the world? Do you think the pharmaceutical businesses have a social responsibility to make drugs that will combat diseases that are a result of poor living conditions, even though profits will be limited?..
Determine the process sigma quality level : A manufacturing firm is attempting to determine whether an existing machine is capable of milling an auto part that has a key specification of 2±0.004 inches. After a trial run on this machine, they have determined that the machine has a process mean..
Hypothesis testing and confidence intervals : In biostatistics, hypothesis testing is used to determine the likelihood of observing a particular value of a sample statistic. Confidence intervals provide a measure of accuracy by allowing us to define a range within which the true population param..
Find the dew point temperature of the coil : Find the design cooling and heating loads of UC 2011. Consider UC 2011 is a detached room. You are free to assume any values reasonably for the calculation. Consult different charts, tables and climate data as necessary. Assuming 40% fresh air and 60..
Write a program that prompts the user for a positive integer : Write a program that prompts the user for a positive integer greater than 1. The program should then output either "prime" if the given number is a prime or "composite" otherwise. Recall that an integer is prime if and only if its only divisors are 1..
We want to use excel to generate a frequency distribution : We want to use Excel to generate a frequency distribution and histogram for these data. The most appropriate bin values for generating these would be
Which of these variables is qualitative : An office supply catalogue gives a description of bookshelves that includes the following variables. Which of these variables is qualitative?
Which entry-deterring behavior is most often used : Of the six possibilities, which entry-deterring behavior is most often used? Explain why you think that strategy was chosen most often? If you were the CEO of a firm, which entrydeterring behavior would you prefer to use? Explain, and be specific.
If the objective is one of redistribution : If the objective is one of redistribution, what are the welfare implications of achieving this redistribution by providing cash supplements versus medical care to the desired beneficiary group?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd