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

  Design electronic submission of assignments from students

This system must manage electronic submission of assignments from students to instructors. It must keep track of which students have submitted assignments and must allow instructors to manage the grading.

  Create set-list of enumerated constants called week

Create set/list of enumerated constants called week which contains days of week. Have variable called today that is of kind week. Allot a value to today.

  Trace the program

We are going to trace the following program, i.e. simulate in your head how it would execute on a computer. To help you, a trace table is provided for you to fill. Unlike exam E1, our focus here is not only on keeping track of the values of each v..

  Create a main loop to accepts text commands

Using the ADT described in Dale p280-282, implement a FIFO Queue. Then create a main loop that accepts text commands as specified below and executes the appropriate FIFO queue functions.

  Calculate the sum of squares of numbers using for loop

Given int variables k and total which have already been declared, use for loop to calculate the sum of squares of first 50 counting numbers, and store this value in total.

  Determine seperate total of positive and negative numbers

Read set of 40 positive and negative numbers entered from keyboard and determine seperate total of positive and negative numbers. How to show modular design of above statement

  Presenting football greatest expertise of reviewing

The start of Buy Fifa Coins the one of the most well-known minutes presenting football greatest expertise of reviewing. Before we look into the coordinate it is only reasonable to take a brief look into the gamer considered as one of the best game..

  Write application to input numbers in one dimensional array

Use a one dimensional array to solve the following problem: Write an application that inputs five numbers, each between 10 and 100, inclusive.

  Create a user interface that uses the gridlayout manager

Define and compile the following two classes that will represent seats in a stadium and When creating a new Stadium, the constructor above will fill a 27x35 two-dimensional array of Seat objects, where each Seat has a number, row and section.

  Program to display employees-total hours in decreasing order

The following array stores work hours for eight employees, write program which display employees and their total hours in decreasing order of total hours.

  Program-inputting data from files-writing-calling functions

This program will give you practice inputting data from files, writing and calling functions, using linked lists and outputting data to a file. You should only use one linked list of structs.

  Write a program to read the data from csv file

Write a program that will read the data from the CSV file into an ArrayList of State objects where each State object stores information about all County objects for that state.

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