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
spayn [35]
2 years ago
13

Using C++

Computers and Technology
1 answer:
jarptica [38.1K]2 years ago
4 0

Answer:

K

Explanation:

Using C++

Your program should accept y or n for input to all questions, and does not need to handle invalid inputs.

First, your program should ask the user if they want pizza. If not, your program should exit without creating and saving any image.

However, if the user does want pizza, your program should ask about toppings, first tomato sauce, then cheese, then pepperoni, then jalapeno, then onion. (Make sure you spell the toppings correctly, because the unit tests are are checking for exact matches!) For each topping, the user can respond y or n.

Finally, your program should save the pizza image to pizza.bmp, and tell the user the filename so they can find it.

Here is an example where the user wants a pizza with all the toppings:

Welcome to PizzaMaker 2.0!

Would you like a pizza?

(y/n): y

Would you like tomato sauce?

(y/n): y

Would you like cheese with that?

(y/n): y

Would you like pepperoni?

(y/n): y

Would you like jalapeno with that?

(y/n): y

Would you like onion?

(y/n): y

Great! Your pizza is at pizza.bmp. Enjoy!

Note: You must add toppings in the specified order here. This is called a "spec" (for specification), and it's important to implement exactly to the "spec" so that the customer knows what they are getting.

You might be interested in
The ________ of the operating system enables users to communicate with the computer system. Select one: A. user interface B. mod
Mumz [18]
The user interface of the operating system
8 0
3 years ago
What was the name of the first computer (machine) language?
Angelina_Jolie [31]

In 1957, the first of the major languages appeared in the form of FORTRAN. Its name stands for FORmula TRANslating system. The language was designed at IBM for scientific computing. The components were very simple, and provided the programmer with low-level access to the computers innards.


8 0
3 years ago
Read 2 more answers
The dashed lines that display on your slide when you are moving an object are
diamong [38]
The answer is "smart guides".
6 0
3 years ago
We have said that the average number of comparisons need to find a target value in an n-element list using sequential search is
bija089 [108]

Answer:

Part a: If the list contains n elements (where n is odd) the middle term is at index (n-1)/2 and the number of comparisons are (n+1)/2.

Part b: If the list contains n elements (where n is even) the middle terms are  at index (n-2)/2 & n/2 and the number of comparisons are (n+2)/2.

Part c: The average number of comparisons for a list bearing n elements is 2n+3/4 comparisons.

Explanation:

Suppose the list is such that the starting index is 0.

Part a

If list has 15 elements, the middle item would be given at 7th index i.e.

there are 7 indices(0,1,2,3,4,5,6) below it and 7 indices(8,9,10,11,12,13,14) above it. It will have to run 8 comparisons  to find the middle term.

If list has 17 elements, the middle item would be given at 8th index i.e.

there are 8 indices(0,1,2,3,4,5,6,7) below it and 8 indices(9,10,11,12,13,14,15,16) above it.It will have to run 9 comparisons  to find the middle term.

If list has 21 elements, the middle item would be given at 10th index i.e.

there are 10 indices (0,1,2,3,4,5,6,7,8,9) below it and 10 indices (11,12,13,14,15,16,17,18,19,20) above it.It will have to run 11 comparisons  to find the middle term.

Now this indicates that if the list contains n elements (where n is odd) the middle term is at index (n-1)/2 and the number of comparisons are (n+1)/2.

Part b

If list has 16 elements, there are two middle terms as  one at would be at 7th index and the one at 8th index .There are 7 indices(0,1,2,3,4,5,6) below it and 7 indices(9,10,11,12,13,14,15) above it. It will have to run 9 comparisons  to find the middle terms.

If list has 18 elements, there are two middle terms as  one at would be at 8th index and the one at 9th index .There are 8 indices(0,1,2,3,4,5,6,7) below it and 8 indices(10,11,12,13,14,15,16,17) above it. It will have to run 10 comparisons  to find the middle terms.

If list has 20 elements, there are two middle terms as  one at would be at 9th index and the one at 10th index .There are 9 indices(0,1,2,3,4,5,6,7,8) below it and 9 indices(11,12,13,14,15,16,17,18,19) above it. It will have to run 11 comparisons  to find the middle terms.

Now this indicates that if the list contains n elements (where n is even) the middle terms are  at index (n-2)/2 & n/2 and the number of comparisons are (n+2)/2.

Part c

So the average number of comparisons is given as

((n+1)/2+(n+2)/2)/2=(2n+3)/4

So the average number of comparisons for a list bearing n elements is 2n+3/4 comparisons.

6 0
3 years ago
Create a method called nicknames that passes an array as a parameter. Inside the method initialize it to hold 5 names of your ch
Gre4nikov [31]
<h2>Answer:</h2>

    //======METHOD DECLARATION=========//          

    //method name: nicknames                                          

    //method return type: void                                            

    //method parameter: an array reference                    

    public static void nicknames(String [] names){      

       //initialize the array with 5 random names              

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       //using an enhanced for loop, print out the elements in the array

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

<h2>Explanation:</h2>

The program is written in Java. It contains comments explaining important parts of the code. Kindly go through these comments.

A few things to note.

i. Since the method does not return any value, its return type is <em>void</em>

ii. The method is made public so that it can be accessible anywhere in and out of the class the uses it.

iii. The method is made static since it will most probably be called in the static main method (at least for testing in this case)

iv. The method receives an array of type <em>String </em>as parameter since the names to be stored are of type <em>String</em>.

v. The format of initializing an array manually should follow as shown on line 7. The <em>new</em> keyword followed by the array type (String), followed by the square brackets ([]) are all important.

vi. An enhanced for loop (lines 9 - 11) is a shorthand way of writing a for loop. The format is as follows;

=> The keyword <em>for</em>

=> followed by an opening parenthesis

=> followed by the type of each of the elements in the array. Type String in this case.

=> followed by a variable name. This holds an element per cycle of the loop.

=> followed by a column

=> followed by the array

=> followed by the closing parenthesis.

=> followed by a pair of curly parentheses serving as a block containing the  code to be executed in every cycle of the loop. In this case, the array elements, each held in turn by variable n, will be printed followed by a space.

A complete code and sample output for testing purposes are shown as follows:

==================================================

public class Tester{

    //The main method

    public static void main(String []args){

       

       String [] names = new String[5];

       nicknames(names);

    }

   

  //The nicknames method

    public static void nicknames(String [] names){

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

}

==================================================

<h2>Output:</h2>

John Doe Brian Loveth Chris

<em>NB: To run this program, copy the complete code, paste in an IDE or editor and save as Tester.java</em>

6 0
2 years ago
Other questions:
  • How does the use of modules provide flexibility in a structured programming design?
    14·2 answers
  • What is the minimum number of bits you need to encode the 26 letters of the alphabet plus a space?Pace?
    11·1 answer
  • In modern computer memory, each location is normally composed of one byte.
    7·1 answer
  • Windows uses a memory-management technique known as ________ to monitor which applications you use most frequently and then prel
    8·1 answer
  • This operator represents the logical AND.
    7·1 answer
  • While creating a sketch, what helps you identify positive and negative space?
    13·1 answer
  • This can change the fit of your respirator. A) A mustacheB) A beardC) Weight gainD) All of the above
    15·1 answer
  • Writers in our networked world enhance their credibility by
    5·1 answer
  • What is a common use for append queries?
    14·2 answers
  • A trace table is used for
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!