Description
c++ code . I need the code to be simple for beginner . using loobs , condition statement, void faction and value return faction if necessary
Unformatted Attachment Preview
B. A function that reads in 25 numbers from a file, and then does the following things;
Determines how many of the numbers are even numbers
Determines how many of the numbers are odd numbers
Determines how many of the numbers are positive numbers
Determines how many of the numbers are negative numbers
Determine how many of the numbers are zero
Determine the sum of all 25 numbers
app 41
All the above should be calculated in the function, but the output should be done in the main functio
Negative numbers can also be odd and even)
Create the file and use the following numbers
02-12 15 0-7 -1 28 123 14-863 17
11-189 0 1283 290-120 151 -63 13 230 0-77-2
Purchase answer to see full attachment
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Explanation & Answer
Hello check the c++ code and the source .thank you
The following is the C++ program s...
Completion Status:
100%
Review
Review
Anonymous
Just what I was looking for! Super helpful.
Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4
24/7 Homework Help
Stuck on a homework question? Our verified tutors can answer all questions, from basic math to advanced rocket science!
Most Popular Content
Answer BNF grammar questions
Answer each of the following problems. If a grammar is requested, youmay express it as a formal context-free grammar, or i ...
Answer BNF grammar questions
Answer each of the following problems. If a grammar is requested, youmay express it as a formal context-free grammar, or in an equivalentBNF form.
Python Code
Project 2: Grocery ListIntroductionYour task for this project is to create a very simple grocery list script. This script ...
Python Code
Project 2: Grocery ListIntroductionYour task for this project is to create a very simple grocery list script. This script also emphasizes the importance of using lists, dictionaries and loop types within your script and how the use of those functions shapes your approach in creating a script.The task is broken down into three sections:User InputLoop through the grocery listProvide output to the consoleData StructureThe structure of the data for this project is extremely important.Each grocery item is a dictionary with the following key-value pairsa name of the grocery item with the key identifier 'name'the number of grocery items purchased with the key identifier 'number'the cost of the grocery item with the key identifier 'price'{'name': 'milk', 'number': int(1), 'price': float(2.99)}grocery_history is a list of grocery item dictionary elements.The following is an example of initializing a list with items:grocery_history=[{'name': 'milk', 'number': int(1), 'price': float(2.99)},
{'name': 'eggs', 'number': 2, 'price': 3.99},
{'name': 'onions', 'number': 4, 'price': 0.79}]
Task: Create the empty data structureCreate an empty dictionary with the variable name grocery_itemCreate an empty grocery_history listControl StructureThe variable stop will be used with a while loop to check if the loop condition is true (and the loop will continue) or if the loop condition is false (and the loop will exit).In this script, the loop will end when the user enters ‘q’As the code in the while loop should run at least once, set the stop variable to anything other that 'q’, e.g. 'go' or Truestop = 'go'Write a loop that will be used to collect user input.The While loop will use the stop variable to determine if the user has completed entering their grocery items.The following steps will all be completed if the loop condition is met (i.e., the user has not entered 'q'):Accept input of the name of the grocery item purchased.Prompt: "Item name:\n"Variable: item_nameAccept input of the quantity of the grocery item purchased.Prompt: "Quantity purchased:\n"Variable: quantityAccept input of the cost of the grocery item input (this is a per-item cost).Prompt: "Price per item:\n"Variable: costCreate a dictionary entry in the loop which contains the name, number and price entered by the user. Assign the entry to a variable named grocery_itemThe format will be:
{'name':item_name, 'number': int(quantity), 'price': float(cost)}Add the grocery_item to the grocery_history list using the append functionPrompt the user for input asking if they have finished entering grocery items. Use the prompt:"Would you like to enter another item?\nType 'c' for continue or 'q' to quit:\n"Looping Through the ListIn this section, you will loop through the grocery_history list. For each item, you will:Print the number of that item purchasedPrint the name of the itemPrint the price paid for all of those items purchasedAdd this price to the grand total for the entire listYour results will look similar to this:2 apple @ $1.49 ea $2.98
1 milk @ $3.99 ea $3.99
Grand total: $6.97
Print the ListDefine variable to hold grand total called grand_totalDefine a 'for' loop. This loop will examine each element in the grocery_history list.The loop will use the 'for in' convention. Each grocery_history list element will be assigned to a variable named 'grocery_item'Inside the for loop:Calculate the total cost for the grocery_item.The calculation is:item_total = number * priceAdd the item_total to the grand_totalOutput the information for the grocery item to match this example:Output →2apple@$1.49ea$2.98Variable →numbernamepriceitem_totalReminderYour can use the %.2f formatting expression to format the dollar amountsSet the item_total equal to 0Finally, after printing all the items, print the grand total!'''The task is broken down into three sections.Section 1 - User InputSection 2 - loop through the grocery listSection 3 - provide output to the console'''#Task: Create the empty data structuregrocery_item = ?grocery_history = ?#Variable used to check if the while loop condition is metstop = 'go'while ?????? : #Accept input of the name of the grocery item purchased. #Accept input of the quantity of the grocery item purchased. #Accept input of the cost of the grocery item input (this is a per-item cost). #Using the update function to create a dictionary entry which contains the name, number and price entered by the user. #Add the grocery_item to the grocery_history list using the append function #Accept input from the user asking if they have finished entering grocery items.# Define variable to hold grand total called 'grand_total'#Define a 'for' loop. for ??????? in ?????????: #Calculate the total cost for the grocery_item. #Add the item_total to the grand_total #Output the information for the grocery item to match this example: #2 apple @ $1.49 ea $2.98 #Set the item_total equal to 0#Print the grand total
CS 3733 The University of Texas San Antonio Thread Synchronization Practice
This assignment requires you to implement a solution to the famous Dining Philosophers problem using multithreading and co ...
CS 3733 The University of Texas San Antonio Thread Synchronization Practice
This assignment requires you to implement a solution to the famous Dining Philosophers problem using multithreading and concurrent programming techniques. The problem was the brainchild of Dr. E. W. Dijkstra, in which five philosophers spend their lives simply thinking and eating, to the exclusion of all of activities. They sit together on a circular table featuring five chairs. The table contains a single plate of spaghetti from which they apportion their servings from. However, there are only five chopsticks available, as shown in the figure.This assignment requires you to implement a solution to the famous Dining Philosophers problem using multithreading and concurrent programming techniques. The problem was the brainchild of Dr. E. W. Dijkstra, in which five philosophers spend their lives simply thinking and eating, to the exclusion of all of activities. They sit together on a circular table featuring five chairs. The table contains a single plate of spaghetti from which they apportion their servings from. However, there are only five chopsticks available, as shown in the figure.
6 pages
Listening Skills Rev
When communicating with my friends, I can tell when a person is listening or not. When I observe my two friends here talki ...
Listening Skills Rev
When communicating with my friends, I can tell when a person is listening or not. When I observe my two friends here talking, I can tell that they ...
4 pages
Parts Of The Brain
For learning to occur, information must first be stored in the human brain. This implies that the brain is the human organ ...
Parts Of The Brain
For learning to occur, information must first be stored in the human brain. This implies that the brain is the human organ which is highly responsible ...
Similar Content
Indiana University Purdue Binary Search Tree Java Programming
need the code and expect a 90 percent grade or higher. thanks for the help. ...
CU Java Swing Mythical Beartooth Hiking Company Problem
Homework for Swing/Graphics
Assignment:
Now that you are an expert Swing designer, let's take some of that knowledge and a...
Computer Programming
Information
Systems Security Survey
As a new graduate of UMUC’s cybersecurity program, you
have decided to apply in a...
web design
W3C is focusing on technologies to enable Web access anywhere, anytime, using any device. For this paper: Students will c...
CSCI 141 Case Western Reserve University Attendance Program in Java
this is my final project I need an explanation with it So I can present it. Follow the contract please because it will be ...
Arizona State University Bootstrap Website Using HTML, CSS & JavaScript
Hello, I need help with the following assignment using bootstrap to create a simple website. I honestly do not care how th...
Report
The data is extracted from the excel file and stored in MATLAB using the following code: % Clear the workspace and the com...
Data Warehousing
Data warehousing involve the catch of information from many sources for valuable investigation and access, however does no...
Jamalallailhashimassignment2
VALUES ('555-123-1212', '205-555-5523', '2013-7-14', 'Antique Desk', 3000.00); VALUES ('555-123-1212', '205-555-5523', '20...
Related Tags
Book Guides
Get 24/7
Homework help
Our tutors provide high quality explanations & answers.
Post question
Most Popular Content
Answer BNF grammar questions
Answer each of the following problems. If a grammar is requested, youmay express it as a formal context-free grammar, or i ...
Answer BNF grammar questions
Answer each of the following problems. If a grammar is requested, youmay express it as a formal context-free grammar, or in an equivalentBNF form.
Python Code
Project 2: Grocery ListIntroductionYour task for this project is to create a very simple grocery list script. This script ...
Python Code
Project 2: Grocery ListIntroductionYour task for this project is to create a very simple grocery list script. This script also emphasizes the importance of using lists, dictionaries and loop types within your script and how the use of those functions shapes your approach in creating a script.The task is broken down into three sections:User InputLoop through the grocery listProvide output to the consoleData StructureThe structure of the data for this project is extremely important.Each grocery item is a dictionary with the following key-value pairsa name of the grocery item with the key identifier 'name'the number of grocery items purchased with the key identifier 'number'the cost of the grocery item with the key identifier 'price'{'name': 'milk', 'number': int(1), 'price': float(2.99)}grocery_history is a list of grocery item dictionary elements.The following is an example of initializing a list with items:grocery_history=[{'name': 'milk', 'number': int(1), 'price': float(2.99)},
{'name': 'eggs', 'number': 2, 'price': 3.99},
{'name': 'onions', 'number': 4, 'price': 0.79}]
Task: Create the empty data structureCreate an empty dictionary with the variable name grocery_itemCreate an empty grocery_history listControl StructureThe variable stop will be used with a while loop to check if the loop condition is true (and the loop will continue) or if the loop condition is false (and the loop will exit).In this script, the loop will end when the user enters ‘q’As the code in the while loop should run at least once, set the stop variable to anything other that 'q’, e.g. 'go' or Truestop = 'go'Write a loop that will be used to collect user input.The While loop will use the stop variable to determine if the user has completed entering their grocery items.The following steps will all be completed if the loop condition is met (i.e., the user has not entered 'q'):Accept input of the name of the grocery item purchased.Prompt: "Item name:\n"Variable: item_nameAccept input of the quantity of the grocery item purchased.Prompt: "Quantity purchased:\n"Variable: quantityAccept input of the cost of the grocery item input (this is a per-item cost).Prompt: "Price per item:\n"Variable: costCreate a dictionary entry in the loop which contains the name, number and price entered by the user. Assign the entry to a variable named grocery_itemThe format will be:
{'name':item_name, 'number': int(quantity), 'price': float(cost)}Add the grocery_item to the grocery_history list using the append functionPrompt the user for input asking if they have finished entering grocery items. Use the prompt:"Would you like to enter another item?\nType 'c' for continue or 'q' to quit:\n"Looping Through the ListIn this section, you will loop through the grocery_history list. For each item, you will:Print the number of that item purchasedPrint the name of the itemPrint the price paid for all of those items purchasedAdd this price to the grand total for the entire listYour results will look similar to this:2 apple @ $1.49 ea $2.98
1 milk @ $3.99 ea $3.99
Grand total: $6.97
Print the ListDefine variable to hold grand total called grand_totalDefine a 'for' loop. This loop will examine each element in the grocery_history list.The loop will use the 'for in' convention. Each grocery_history list element will be assigned to a variable named 'grocery_item'Inside the for loop:Calculate the total cost for the grocery_item.The calculation is:item_total = number * priceAdd the item_total to the grand_totalOutput the information for the grocery item to match this example:Output →2apple@$1.49ea$2.98Variable →numbernamepriceitem_totalReminderYour can use the %.2f formatting expression to format the dollar amountsSet the item_total equal to 0Finally, after printing all the items, print the grand total!'''The task is broken down into three sections.Section 1 - User InputSection 2 - loop through the grocery listSection 3 - provide output to the console'''#Task: Create the empty data structuregrocery_item = ?grocery_history = ?#Variable used to check if the while loop condition is metstop = 'go'while ?????? : #Accept input of the name of the grocery item purchased. #Accept input of the quantity of the grocery item purchased. #Accept input of the cost of the grocery item input (this is a per-item cost). #Using the update function to create a dictionary entry which contains the name, number and price entered by the user. #Add the grocery_item to the grocery_history list using the append function #Accept input from the user asking if they have finished entering grocery items.# Define variable to hold grand total called 'grand_total'#Define a 'for' loop. for ??????? in ?????????: #Calculate the total cost for the grocery_item. #Add the item_total to the grand_total #Output the information for the grocery item to match this example: #2 apple @ $1.49 ea $2.98 #Set the item_total equal to 0#Print the grand total
CS 3733 The University of Texas San Antonio Thread Synchronization Practice
This assignment requires you to implement a solution to the famous Dining Philosophers problem using multithreading and co ...
CS 3733 The University of Texas San Antonio Thread Synchronization Practice
This assignment requires you to implement a solution to the famous Dining Philosophers problem using multithreading and concurrent programming techniques. The problem was the brainchild of Dr. E. W. Dijkstra, in which five philosophers spend their lives simply thinking and eating, to the exclusion of all of activities. They sit together on a circular table featuring five chairs. The table contains a single plate of spaghetti from which they apportion their servings from. However, there are only five chopsticks available, as shown in the figure.This assignment requires you to implement a solution to the famous Dining Philosophers problem using multithreading and concurrent programming techniques. The problem was the brainchild of Dr. E. W. Dijkstra, in which five philosophers spend their lives simply thinking and eating, to the exclusion of all of activities. They sit together on a circular table featuring five chairs. The table contains a single plate of spaghetti from which they apportion their servings from. However, there are only five chopsticks available, as shown in the figure.
6 pages
Listening Skills Rev
When communicating with my friends, I can tell when a person is listening or not. When I observe my two friends here talki ...
Listening Skills Rev
When communicating with my friends, I can tell when a person is listening or not. When I observe my two friends here talking, I can tell that they ...
4 pages
Parts Of The Brain
For learning to occur, information must first be stored in the human brain. This implies that the brain is the human organ ...
Parts Of The Brain
For learning to occur, information must first be stored in the human brain. This implies that the brain is the human organ which is highly responsible ...
Earn money selling
your Study Documents