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
malfutka [58]
3 years ago
12

Write the one Sale method of the GroceryStore class. Method oneSale has one parameter: the name of one product (that a customer

would like to buy). Method oneSale should attempt to carry out the sale of the named product, and it should return true or false depending on whether the sale is successful. The sale is successful if there is a product in the stock array with the given name and if the number of items in stock of that product is greater than zero. In that case, one Sale should subtract one from the number of items in stock and return true. If there is no product in the stock array with the given name or if the number of items in stock for that product is less than or equal to zero, oneSale should return false.
Computers and Technology
1 answer:
DIA [1.3K]3 years ago
8 0

Answer:

Check the explanation

Explanation:

bool oneSale(string item){

for(int i=0;i<capacity;i++){ // iterate till the capcity of array

if(item==grocerryList[i].name()){ // if name matches

 if(grocerryList[i].getStock()>0){ // and stock is greater than 0

  grocerryList[i].setStock(grocerryList[i].getStock()-1); // subtract 1 from the stock

// or alternate is grocerryList[i].stock= grocerryList[i].stock-1;

 return true; // return true

}

}

else if(item==grocerryList[i].name()){ // if name matches

 if(grocerryList.getStock()==0){ // but stock is empty

 return false; // return falsse

}

}

else{ // means item is not available so there is no need to check stock

return false; // return false

}

}

}

You might be interested in
On a printed circuit board, electronic components will be mounted from the
Likurg_2 [28]
On a printed circuit board, electronic parts will be mounted from the substrate side of the board. The leads jab through the substrate and the copper sheeting that has been carved. The leads are then soldered to the copper.

I hope the answer will help you. 
3 0
3 years ago
: Describe the type of gameplay seen during early video games (ex. Spacewar!, Pong).
Alexeev081 [22]

Answer:

Computer scientists began building rudimentary games and simulations on mainframe computers in the 1950s and 1960s, with MIT's Spacewar! in 1962 being one of the first such games to be played with a video display. The first consumer-ready video game hardware arrived in the early 1970s, with the Magnavox Odyssey, the first home video game system, and the first arcade video games from Atari, Computer Space and Pong, the latter of which was later transformed into a home console version. Pong's success in arcades and at home prompted numerous firms to create clones of the game, resulting in a market contraction in 1978 owing to oversaturation and a lack of innovation.

8 0
3 years ago
Suppose you can access the caches in the local DNS servers of your department. Can you propose a way to roughly determine the We
lubasha [3.4K]

Answer:

We can periodically take a snapshot of the Domain Name System (DNS) caches in the local  Domain Name System (DNS) servers.

Explanation:

We can periodically take a snapshot of the Domain Name System (DNS) caches in the local  Domain Name System (DNS) servers. The Web server that appears most frequently in the  Domain Name System (DNS) caches is the most popular server. This is because if more users are interested in a Web server, then Domain Name System (DNS) requests for that server are more frequently sent by users. Thus, that Web server will appear in the  Domain Name System (DNS) caches more frequently.  

6 0
3 years ago
To quickly modify fonts, colors, and effects on a slide, a user can modify the _____. (Microsoft PowerPoint)
velikii [3]

<u>Answer</u>:

To quickly modify fonts, colours, and effects on a slide, a user can modify the Theme.

<u>Explanation</u>:

In Microsoft power point a theme is a group or collection of fonts , colours and effects that are pre-formatted to improve or enhance the presentation. We can  start changing the font , colours or effects or any pre-existing  themes  by selecting them.  

To Change colour:

  • In Design tab,  under the  Variants group, click on  the downward  and choose one colour from the colour variant gallery.
  • Now click on the customise colours which opens the  "Create New Theme Colours" dialog box. In this dialog box , in the  theme colours  we can make the necessary changes and save them as a new theme.

To change fonts:

  • In the View tab, choose Slide Master.In this tab, select "Fonts" and then select Customise Fonts.
  • Now "Create New Theme Fonts" dialog box opens where use can choose the required font size under the Heading font and Body font boxes.  Again this can be saved as a new theme. Changing the font of theme changes all the bullet texts and title.
7 0
3 years ago
A manager in a small office is asking if it is possible to limit network access to a particular website during business hours. A
Lady_Fox [76]

Answer:

Implement a blacklist on the firewall and add the site the users are visiting.

Explanation:

A manager in a small office is asking if it is possible to limit network access to a particular website during business hours. Apparently, several users are spending an excessive amount of time on the site preventing them from completing their work-related tasks. The best solution to accomplish the request from the manager is to implement a blacklist on the firewall and add the site the users are visiting.

3 0
4 years ago
Other questions:
  • Pix blocks półfinały skilled
    7·1 answer
  • The following algorithm should output the t times table in the format:
    6·1 answer
  • The box formed by the intersection of a row and column in a spreadsheet program is known as a ________.
    13·1 answer
  • A ____ is a battery-operated power source directly attached to one or more devices and to a power supply (such as a wall outlet)
    14·1 answer
  • Which is the last step in conducting a URL search?
    14·2 answers
  • Which among the following choices is correct based on the two statements listed below? Statement 1: When the lexical analyzer sc
    12·1 answer
  • How does recorded audio stay on an audio tape
    12·1 answer
  • Exercise 3.6.9: 24 vs. "24"5 points
    7·1 answer
  • Choose the missing words in the code below.
    12·1 answer
  • What happens when you create a variable in a video game program?​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!