Write the output of the following:
DECLARE FUNCTION
program
SUM (A, B)

Answers

Answer 1

Answer:

#include<studio.h>

Int main()

{

Int a=10, b= 20, sum;

Sum =a+b;

Printf(“ sum = %d”, sum );

Return 0;

}

Explanation:

Let's Assume A = 10 and B = 20


Related Questions

Your cousin asks you to help her prepare for her computer science exam next week. She gives you two clues about a type of relational database key: No column values may be NULL, and columns must be necessary for uniqueness. Which type of key is she referring to

Answers

In the case above, the type of key that she is referring to composite primary key.

What is the key about?

A primary key is known to be one that is made up of a column, or group of columns and it is often used to know a row.

The composite primary key is made up of multiple columns, known for its uniqueness, and as such In the case above, the type of key that she is referring to composite primary key.

Learn more about composite primary key from

https://brainly.com/question/10167757

#SPJ1

Got a assignment and need help to do it or figure it out. Its too make 2 python codes that run for
1. Write a program to ask the user to input the number of hours a person has worked in a week and the pay rate per hour.

2. Jennifer wants to carpet her new room with a carpet. Create a program that will work out the area of any sized room, (l x w) Save as area of rectangle.py
Need help with it.

Answers

Answer:

Explanation:

For input,

val = input("Enter your value: ")

print(val)

Haven't done python in while so I can't help with second one.

Upon stopping alcohol service to an obviously intoxicated person, the server should:.

Answers

Upon stopping alcohol service to an obviously intoxicated person, the server should:

Never embarrass the customer, mostly in front of other people.Call a cab for them or call someone to pick them up using their phones under permission.

How to deal with an intoxicated customer?

The steps to Handle Intoxicated customer are:

Be calm.Never argue with the intoxicated customer.Never embarrass the customer, mostly in front of other people.Call a cab for them or call someone to pick them up using their phones under permission.

So it is better that Upon stopping alcohol service to an obviously intoxicated person, the server should:

Never embarrass the customer, mostly in front of other people.Call a cab for them or call someone to pick them up using their phones under permission.

Learn more about intoxicated person from

https://brainly.com/question/27218972

#SPJ1

Having two, or even three, people explain the material to you
a. Will help you understand it
C.
b. Will give you too many perspectives
O
OB
Please select the best answer from the choices provided
D
d.
Mark this and return
Will just confuse you. Its better to only ask
one person to help
Will decrease your understanding of the
material

Answers

B. Will give you too many perspectives


What penalties can occur for a first offense DUI
that did not result in a fatal injury?

Jail time

Must apply for a new license after
revocation

Charged with a felony

Your vehicle impounded

Fines

Alcohol or drug treatment program

Install an Ignition Interlock Device on your car

Suspension or revocation of your driver's license

(Nevada) You check Boxes

Answers

The penalties that  an occur for a first offense DUI that did not result in a fatal injury are:

Your vehicle impounded.Fines.Alcohol or drug treatment program.Suspension or revocation of your driver's license.

What is the penalty for first time DUI?

When a person has a first-offense DUI, the effect for conviction generally is made up of three years of informal probation, fines and taking or completing a first offender alcohol program.

Therefore, The penalties that  an occur for a first offense DUI that did not result in a fatal injury are:

Your vehicle impounded.Fines.Alcohol or drug treatment program.Suspension or revocation of your driver's license.

Learn more about DUI from

https://brainly.com/question/988799

#SPJ1

What is an example of work performed by an integration platform as a service (ipaas)?

Answers

Answer:

An example of work performed by an Integration Platform as a Service (IPaaS) is setting up and configuring cloud-based servers.

- IPaaS is the solution for hosting, developing, and integrating cloud data.

- With help of IPaaS, users can develop integration flows that connect applications that reside in the cloud.

- The best IPaaS solutions consist of easy graphic tools that help visualize. - It is also referred as cloud integration platform

- IPaaS has the ability to provide everything from data warehousing and infrastructure to DevOps environments and application design.

- IPaaS solutions blend services and tools into service-oriented architecture (SOA)

- This gives organizations the ability to share information and resources across applications.

Explanation:

iPaaS, or Integration-Platform-as-a-Service, is a self-service cloud-based solution that standardizes how applications are integrated. Developers, consultants and even non-technical users can use iPaaS out-of-the-box to quickly build the integration flows for sharing data within an organization or with multiple companies.

In 2018, the rules changed and Olympic organizers allowed the use of _____ music in performances for the first time

Answers

In 2018, the rules changed and Olympic organizers allowed the use of vocal music in performances for the first time.

What is an Olympic Charter?

An Olympic Charter can be defined as the fundamental rules, regulations and principles which governs the Olympic Games, and they must be adopted by the International Olympic Committee (IOC) as guidelines for hosting and organizing the Olympic Games.

In Pyeongchang 2018, the rules changed and Olympic organizers allowed the use of vocal music in performances for the first time for figure skaters.

Read more on Olympics here: https://brainly.com/question/18765613

#SPJ1

Write a program that calculates pay for either an hourly paid worker or a salaried worker Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are paid their regular salary plus any bonus they may have earned. The program should declare two structures for the followingdata Hourly Paid Salary Bonus The program should also declare a union with two members. Each member should be a structure variable: one for the hourly paid worker and another for the salaried worker. The union should be part of another structure that also contains a flag for what portion of the union should be used. (If you have questions about this part, please email the instructor) The program should ask the user whether he or she is calculating the pay for an hourly paid worker or a salaried worker. Regardless of which the user selects, the appropriate members of the union will be used to store the data that will be used to calculate the pay Use the following flow structure and functions: Function: Main-Askes user if salaried or hourly. Calls appropriate function based on answer to gather information about the worker. Main should receive a worker pointer back. Main then calls the print function for the worker Function:getHourly-Asks the user for the hourly rate and number of hours worked, storing the answers in a new worker object, which it returns Function getSalaried-Asks the user for the salary and bonus for a worker, storing the answers in a new worker object, which it returns Function printWorker-takes a worker object, and prints out a report for the information about the worker, including the gross pay (which would be calculated) Note: Input validation not required, but would be no negative numbers, and no values greater than 80 for hours worked * Your two structures must be named "hourly" and "salaried", the union should be named Accept both capital and lowercase letters for selecting what type of worker from the user

Answers

The program that is required here is a payroll program. See the explanation below.

What is a program?

A program is a series of instructions that are given to a computer in a predetermined language with precise instruction that delivers a specific output.

What is the required program?

The program that calculates the pay - (Payroll program) is given as follows:

#include <iostream>

#include <iomanip>                                                                                                                                                                                        

using namespace std;

int main ()

{

int paycode;

int WeeklySalary;

double pay;

int HourlySalary;

int TotalHours;

int GrossWeeklySales;

int pieces;

int PieceWage;

cout << "Enter paycode (-1 to end): ";

cin  >> paycode;

while (1); {

               

                switch (paycode) {

                               case '1':

                                cout << "Manager selected." << endl;

                                cout << "Enter weekly salary: ";

                                cin  >> WeeklySalary;

                               

                                cout << endl;

                               

                                pay = WeeklySalary;

                                cout << "The manager's pay is $ " << pay;

                                cout << endl;

                               

                               

                                break;

                               

                                case '2':

                                cout << "Hourly worker selected." << endl;

                                cout << "Enter the hourly salary: ";

                                cin  >> HourlySalary;

                               

                                cout << endl;

                                cout << "Enter the total hours worked: " << endl;

                                cin  >> TotalHours;

                               

                                         if ( TotalHours <= 40)

                                                  pay = HourlySalary * TotalHours;

                                                 

                                         else

                                                  pay = (40.0 * HourlySalary) + (TotalHours - 40) * (HourlySalary * 1.5);

                                                 

                                 

                                cout << endl;

                                cout << "Worker's pay is $ " << pay;

                               

                                cout << endl;

                                break;

                               

                                case '3':

                                cout << "Commission worker selected." << endl;

                                cout << "Enter gross weekly sales: ";

                                cin  >> GrossWeeklySales;

                               

                                cout << endl;

                                pay = (GrossWeeklySales *.57) + 250;

                                 

                                cout << " Commission worker's pay is $ " << pay;

                                 break;  

                               

                                case '4':

                                cout << "Pieceworker selected." << endl;

                                cout << "Enter number of pieces: ";

                                cin  >> pieces;

                               

                                cout << "Enter wage per piece: ";

                                cin >> PieceWage;

                               

                                pay = pieces * PieceWage;

                               

                                cout << "Pieceworker's pay is $ " << pay;

                                break;

                                                               

                         

}

                               

}

system ("pause");

return 0;

}

Learn more about programs at;
https://brainly.com/question/1538272
#SPJ1

With SAN technology, servers use a separate network to communicate with the storage device. Group of answer choices True False

Answers

Answer:

true

Explanation:

Which type of data is used by Cisco Cognitive Intelligence to find malicious activity that has bypassed security controls, or entered through unmonitored channels, and is operating inside an enterprise network

Answers

Cisco Cognitive Intelligence often use statistical data made or use for statistical analysis in order to see malicious activity that has bypassed security controls.

What is statistical data?

This can be seen as Quantitative data that is said to be the output  gotten from an act that quantifies, such as how much. e.g.  weight, height, etc.

Cisco Cognitive Intelligence often use statistical data made or use for statistical analysis in order to see malicious activity that has bypassed security controls.

See options below

alert

session

statistical

transaction

Learn more about statistical data from

https://brainly.com/question/15525560

#SPJ1

which of the following needs to be cited within the text of a paper? select all that apply

Answers

The options that require citations are:

Every work that supports the points you make in your writing. Direct quotations must be cited.Works of individuals whose ideas, theories, or research have directly influenced your work.Works that you have read and whose ideas have been incorporated in your writing.What is the citation?

A “citation” is known to be the method used to inform your readers that some material in your work came are obtained from another source.

Note that The options that require citations are:

Every work that supports the points you make in your writing. Direct quotations must be cited.Works of individuals whose ideas, theories, or research have directly influenced your work.Works that you have read and whose ideas have been incorporated in your writing.

See full question below

Which of the following require citations? Select all that apply.

Group of answer choices

Every work that supports the points you make in your writing.

 Direct quotations must be cited.

Works of individuals whose ideas, theories, or research have directly influenced your work.

Each sentence of a paragraph in your writing requires citation.

Works that you have read and whose ideas have been incorporated in your writing.

Learn more about citation from

https://brainly.com/question/8130130

#SPJ1

Any two differences between third and fourth generation of computer

Answers

Answer:

Third generation computer use integrated circuit(IC) and it was fast and reliable.

Forth generation computer micro computer were introduced and they were highly reliable and fast.

Third generation computers were developed in 1965 AD.They used (IC)integrated ciruit.
Forth generation computer were developed in 1971 AD.They used micropocessor.

If I replace this screen with these black spots go away?

Answers

Yes I'm sure they would, these black spots are being caused due to a broken screen!

Hope this helps!!

Yes it will go away if you replace the screen with a new one

Your task is to design a method int[] allMatches(int[] values, int size, int a, int b) that returns all values between a and b inclusive in the partially filled array values. For example, if an array a contains 11, 3, 9, 4, 2, 5, 4, 7, 6, 0, then the call allMatches(a, 8, 3, 7) should return an array containing 3, 4, 5, 4, 7. Note that the 6 is not included because it is past the size of the partially filled array. Arrange the pseudocode below in the right order. Not all lines are useful.
ArrayValues. Java Tester.
java for (int v: values)
{ public class ArrayValues public static intti allatches(int[1 values, int size, int, int b) {
} for (int k = 0; k < size; k++) {
int v = values[k]; for (int k = 0; k < size; k++) {
int v = values[k]; for (int v: values) {
result[1] = v; 1++;
}
int count = 0; )
} if (a int[] result = new int[count);

Answers

The program that returns all values between a and b inclusive in the partially filled array values is illustrated below.

What is a program?

A computer program means a sequence or set of instructions that is in a programming language for a computer to execute.

Here, the program based on the information given will be:

count = 0

for each v in values

if a <= v <= b

 count++

result = new int[count]

i = 0

for each v in values

if a <= v <= b

 result[i] = v

 i++

return result

Java code:

public class ArrayRange {

public static int[] allMatches(int[] values, int size, int a, int b) {

 int count = 0;

 for (int i = 0; i < size; i++) {

  if(values[i] >= a && values[i] <= b) {

   count++;

  }

 }

 int result[] = new int[count];

 count = 0;

 for (int i = 0; i < size; i++) {

  if(values[i] >= a && values[i] <= b) {

   result[count++] = values[i];

  }

 }

 return result;

}

public static void main(String[] args) {

 int[] a = {11, 3, 9, 4, 2, 5, 4, 7, 6, 0};

 int[] returnedArray = allMatches(a, 8, 3, 7);

 for (int i = 0; i < returnedArray.length; i++) {

  System.out.print(returnedArray[i] + " "

Learn more about program on:

https://brainly.com/question/1538272

#SPJ1

Is the following statement valid or invalid? Give reason if it is invalid. int 2a = 6:​

Answers

Answer:when the principle die the irrevocable power of attorney is valid or invalid

Explanation:

In demand paging, when an excessive number of pages are moved back and forth between main memory and secondary storage, it is called ____.

Answers

A thrashing occurs where an excessive number of pages are moved back and forth between main memory and secondary storage,

What is a thrashing?

This is a phenomenon that occurs when the virtual memory is rapidly exchanging data for data on hard disk often at the exclusion of most application-level processing.

Hence, in a computer, the thrashing occurs where an excessive number of pages are moved back and forth between main memory and secondary storage.

Read more about thrashing

brainly.com/question/12978003

#SPJ1

Atomic integers in Linux are useful when A) several variables are involved in a race condition. B) a single process access several variable involved in a race condition. C) an integer variable needs to be updated. D) All of the above.

Answers

Atomic integers in Linux are useful when  an integer variable needs to be updated.

What is an Atomic Integer?

This is known to be an applications that is said to be a form of an atomically incremented counters, and it is one which cannot be used as a kind of replacement for any Integer.

Therefore, Atomic integers in Linux are useful when  an integer variable needs to be updated.

Learn more about Atomic integers from

https://brainly.com/question/20515314

#SPJ1

Draw a circuit with a 12-volt battery and two resistors(100 ohms and 200 ohms) in parallel. What is the total resistance of the circuit?

Answers

The total resistance in the circuit is 66.67 ohm.

What is a circuit?

The circuit is a path designed for the flow of current. We can see that the resistors are connected to a common junction (in parallel) as shown in the image attached to this answer.

The total resistance is obtained from;

1/Rt= 1/R1 + 1/R2

1/Rt= 1/200 + 1/100

1/Rt= 0.005 + 0.01

Rt = 66.67 ohm

Learn more about resistance:https://brainly.com/question/21082756

#SPJ1

Answer:

The total resistance in the circuit is 66.67ohm

PLEASE HELP


Write a pseudo code for an algorithm to wrap a gift.

Answers

in computertional geometry the gift wrapping algorithm is an algorithm for computing the context hull of a given set of points

What type of trust model is used as the basis for most digital certificates used on the internet?

Answers

The type of trust model that is used as the basis for most digital certificates used on the internet is known to be option B. distributed trust.

What is the trust model of the Internet?

The trust model of the internet is known to be one that is made up of tradeoffs.

Note that Distributed trust is seen as the system that is made up of transactions and it is one that is backed up by an extended community and onw where there is no trusted third parties.

Hence, The type of trust model that is used as the basis for most digital certificates used on the internet is known to be option B. distributed trust.

See full question below

What type of trust model is used as the basis for most digital certificates used on the Internet?

A. third-party trust

B. distributed trust

C. related trust

D. managed trust

Learn more about digital certificates from

https://brainly.com/question/24931496

#SPJ1

A technician is testing a connector in a circuit with a voltmeter. With the power on in the circuit, the meter reads 12 volts when the leads are placed on each side of the connector. This indicates that the connector _____.

Answers

Since the technician is testing a connector in a circuit with a voltmeter and the others, one can say that this indicates that the connector is open.

What does an open connection implies?

Connecting to an open network is one that connote that one can opens their device to others using or on that same wireless network.

Note that Since the technician is testing a connector in a circuit with a voltmeter and the others, one can say that this indicates that the connector is open.

Learn more about open connection from

https://brainly.com/question/5338580

#SPJ1

Question 13 :A college has a learning management system (LMS) application that is in the cloud and maintained by the college IT department. The college has a contract with the company that wrote the LMS software to provide access to the LMS during planned maintenance periods and in the event of a disaster. This service is a cloud-based service as well. What cloud architectural model does the college use

Answers

The cloud architectural model that is being used by the college is hybrid cloud.

The types of cloud computing.

In Computer technology, there are three main types of cloud computing and these include the following:

Private cloudPublic cloudHybrid cloud

Basically, a hybrid cloud combines the features of both a private cloud and public cloud. In this scenario, we can logically deduce that the cloud architectural model that is being used by the college is hybrid cloud because both the college's IT department and the company has access to learning management system (LMS) application hosted in the cloud.

Read more on cloud computing here: https://brainly.com/question/17247526

#SPJ1

Device drivers perform the actual communication between physical devices and the operating system. Group of answer choices True False

Answers

Answer:

true

Explanation:

When using encryption from your home computer, how would you configure the router?.

Answers

If one is  using encryption from your home computer, one can configure the router by the use the wireless router to set the encryption key and type of encryption.

What wireless encryption one can use?

The good current standard for encryption for WiFi networks is known to be WPA2 as it is very efficient.

Note that If one is  using encryption from your home computer, one can configure the router by the use the wireless router to set the encryption key and type of encryption.

Learn more about router from

https://brainly.com/question/24812743

#SPJ1

if ( (ans == 'Y' && errors < 5) || numTries < 10 ) // note uppercase 'Y' count++; Which combinations of values result in count being incremented after the statement is complete?

Answers

The correction options to the case abode are:

Option B. ans = 'Y' (upper case)

errors = 6

numTries = 5

Option C. ans = 'y' (lower case)

errors = 4

numTries = 5

Option D. ans = 'Y' (upper case)

errors = 100

numTries = -1

What is Coding?

Computer coding is known to be the act that entails the use of computer programming languages to instruct the computers and machines on a given number of instructions on what need to be  performed.

Note that in the statement above,  the combinations of values results in count being incremented after the statement is complete is option B, C and D.

See full question below

Learn mode about coding from

https://brainly.com/question/22654163

#SPJ1

Write a class with methods to help you balance your checking account (an object class-main method is not in this class). The CheckingAccount Class should have at least two instance variables: the balance and the total service charges, along with methods to get and set each instance variable. You may add other variables and methods if you like. The program should read the initial balance for the month, followed by a series of transactions. For each transaction entered, the program should display the transaction data, the current balance for the account, and the total service charges. Service charges are $0.10 for a deposit and $0.15 for a check. If a check forces the balance to drop below $500.00 at any point during the month, a service charge of $5.00 is assessed but only for the first time this happens. Anytime the balance drops below $50.00, the program should print a warning message. If a check results in a negative balance, an additional service charge of $10.00 should be assessed. A transaction takes the form of an int number (the transaction code), followed by a double number (the transaction amount). If the int number is a 1, then the double number is the amount of a check. If the int number is 2, then the double number is the amount of a deposit. The last transaction is 0 with no number to follow it. Use the JOptionPane to produce the dialog. A sample Input/Output dialogue is provided via the Sample Run Link below. Use proper style and indentation, efficient programming techniques and meaningful variable and method names according to Java conventions.Code Template The following code template will help with this assignment:----------------- Main.java ------------------------public class Main { // global variables // define a CheckingAccount object to keep trach of the // account information public static void main (String[] args) { // defines local variables CS 3 – Spring 2017 E. Ambrosio 2 // get initial balance from the user // perform in a loop until the transaction code = 0 // get the transaction code from the user // and process it with appropriate helper method // When loop ends show final balance to user. } public static __________ getTransCode() { } public static _________ getTransAmt() { } public static __________ processCheck(___________) { } public static __________ processDeposit(___________) { } } --------------------CheckingAccount.java ------------------------- public class CheckingAccount { private double balance; private double totalServiceCharge; public CheckingAccount(double initialBalance) { balance = ______________________; totalServiceCharge = ______________; } public ____________ getBalance() { return _______________; } CS 3 – Spring 2017 E. Ambrosio 3 public void setBalance(double transAmt, int tCode) { if(tCode == 1) balance = ___________________; else //if(tCode == 2) balance = ______________________; } public ____________ getServiceCharge() { return totalServiceCharge; } public void setServiceCharge(double currentServiceCharge) { totalServiceCharge = ___________________________; } }

Answers

Using JAVA knowledge to write code about creating a bank account and using the data to make a transition.

Writing the code in JAVA, we have:

CheckingAccount.java

package bankAccount;

public class Transaction {

int transNumber;

int transId;

double transAmt;

public Transaction(int transNumber, int id, double amount) {

this.transNumber = transNumber;

this.transId = id;

this.transAmt = amount;

}

public int getTransNumber() {

return transNumber;

}

public void setTransNumber(int transNumber) {

this.transNumber = transNumber;

}

public int getTransId() {

return transId;

}

public void setTransId(int transId) {

this.transId = transId;

}

public double getTransAmt() {

return transAmt;

}

public void setTransAmt(double transAmt) {

this.transAmt = transAmt;

}

public String toString() {

return "Transaction Number: " + transNumber + ", Transaction ID: " + transId + " Transaction Amount: " + transAmt;

}

}

See more about JAVA at brainly.com/question/12975450

#SPJ1

Describe the concept behind a digital signature and explain how it relates to cybersecurity by providing a hypothetical example of a situation in which a digital signature could enhance cybersecurity.

Answers

Answer:  A digital signature creates a stamp on a document, that has time, location and is used to assure that the right person was the one that signed

Explanation:   This can be used in a transaction where two two parties who are signing but in two locations

Select the correct answer.
What does virtualization do?
A.
It limits the working of the existing operating system.
B.
It creates barriers in cloud storage.
C.
It combines the existing physical servers into one logical server.
D.
It runs any operating system on your existing operating system.

Answers

Answer:

D.it runs any operating system on your existing operating system

Explanation:

because virtualization is a windows version for virtual machine.

To read encrypted data, the recipient must decipher it into a readable form. What is the term for this process?.

Answers

Answer:

Decryption.

Explanation:

C++ code only
Inventory Items:
We're going to do an inventory management system. In the real world, this would use a database, not a file. A single inventory item contains:
item names (or description), like "socks, - red" or "socks - blue". This has to be a character string that WILL include spaces.
item numbers that are unique to the item, similar to UPC codes, like 121821 or 128122. Even though they look like numbers, they are really character strings.
a price, like 4.99, a double.
a quantity on hand, like 13, an integer.
Your program will need to manage arrays of these items.
-----------------------------------------------------------------------------------
Menu:
Your code need to have the following features, all accessible from a menu.
Add a new inventory item to the data into the array in memory. You'll type in the inventory number, description, quantity and price. This will also update the number of items on the menu screen.
List the inventory (in the array in memory) on the screen in neat columns. Display it in chucks of 15 items with a pause in between.
Search the inventory (in the array in memory) for an item by inventory number. If found, print the stored info, otherwise print 'not found'.
Calculate the total value on hand of the inventory (in the array in memory). The sum is the accumulation of all the (quantities * prices).
Save the array in memory to a disk file. It can then be loaded later.
Read from a disk file to the array in memory. This will overwrite the array in memory with new information from the disk. If you data isn't saved, it will be lost. That how is SHOULD work!
----------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
Menu Sample:
56 items stored
1) Add an item to memory
2) Search memory for an item
3) List what's in memory
4) Total value on hand
5) Save to a file
6) Read in from a file
0) Exit Program
Enter Choice:
-------------------------------------------------------------------------------------------------------------------
How to store the arrays: Parallel Arrays Option
You can maintain 4 arrays, one for each type. You will need to be careful to keep the items in the same position.
string descriptions[1000];
string idNumbers[1000];
float prices[1000];
int quantity[1000];
In this scenario, an item will be spread over the 4 arrays, but all at the same index.
------------------------------------------------------------------------------------------------------------------------------
How to store the data on the disk:
You are required to use the following text based format
Socks - Blue (in the inventory file)
74627204651538
4.99
27
Yellow Socks
25435567456723452345
7.99
27
Each individual item is stored in 4 separate lines. Records follow each other directly.

Answers

Using the computational language C++ it is possible to write a code is possible to create a function that stores items like this:

Writting the code in C++:

//Header files

#include <iostream>

#include <string>

#include <fstream>

using namespace std;

//Class inventoryItem

class inventoryItem

{

public:

//Variable declaration

string itemName;

string itemNumber;

double itemPrice;

int itemQuantity;

};

//implementation of menuItems() function.

void menuItems()

{

// Display the Menu

cout << "=============================\n";

cout << " 1) Add an item to memory\n"

<< " 2) Search memory for an item \n"

<< " 3) List what's in memory\n"

<< " 4) Total value on hand\n"

<< " 5) Save to a file\n"

<< " 6) Read from a file\n"

<< " 0) Exit Program" << endl;

}

//main method.

int main()

{

//variable declaration.

int mnuChoice, cn = 0, d;

string n;

double sum = 0, c;

int temp;

string a, b;

string inputBuffer;

inventoryItem items[100];

ifstream inventoryFile("inventory.txt");

if (inventoryFile)

{

//store the data from the file to memory.

while (!(inventoryFile.eof()))

{

inventoryFile >> items[cn].itemName;

inventoryFile >> items[cn].itemNumber;

inventoryFile >> inputBuffer;

items[cn].itemPrice = atof(inputBuffer.c_str());

inventoryFile >> inputBuffer;

items[cn].itemQuantity = atoi(inputBuffer.c_str());

cn++;

}

inventoryFile.close();

ifstream inventoryFile("inventory.txt");

ofstream fout;

fout.open("inventory.txt");

do

{

menuItems();

cout << cn << " items stored." << endl;

// Prompt and read choice form the user

cout << "Enter your choice: ";

cin >> mnuChoice;

switch (mnuChoice)

{

//Add a new inventory item to the data in memory.

case 1:

// Prompt and read name of the item from the user

cout << "Enter name of the item: ";

cin >> inputBuffer;

items[cn].itemName = inputBuffer;

// Prompt and read itemNumber from the user

cout << "Enter the itemNumber: ";

cin >> inputBuffer;

items[cn].itemNumber = inputBuffer;

// Prompt and read itemPrice from the user

cout << "Enter the itemPrice: ";

cin >> inputBuffer;

items[cn].itemPrice = atof(inputBuffer.c_str());

// Prompt and read itemQuantity from the user

cout << "Enter the itemQuantity: ";

cin >> inputBuffer;

items[cn].itemQuantity = atoi(inputBuffer.c_str());

cn++;

break;

//Search the inventory for an item by inventory number.

case 2:

temp = 0;

cout << "Enter inventory itemNumber: ";

cin >> n;

for (int i = 0; i < cn&&temp != 1; i++)

{

// If found, print the stored info

if (items[i].itemNumber.compare(n) == 0)

{

// Display the stored information

cout << "Item Name" << "\t" << "Item Number" << "\t" << " Item Price" << "\t" << " Item Quantity" << endl;

cout << items[i].itemName << "\t " << items[i].itemNumber << " \t" << items[i].itemPrice << "\t " << items[i].itemQuantity << endl;

temp = 1;

}

}

// otherwise print 'not found'.

if (temp == 0)

{

cout << "Not found!!!" << endl;

}

break;

//List the inventory on the screen

case 3:

cout << "The data in the memory is:" << endl;

cout << "Item Name" << "\t" << "Item Number" << "\t" << " Item Price" << "\t" << " Item Quantity" << endl;

for (int i = 0; i < cn; i++)

{

cout << items[i].itemName << "\t " << items[i].itemNumber << "\t " << items[i].itemPrice << " \t" << items[i].itemQuantity << endl;

}

break;

// Calculate the total value on hand.

case 4:

for (int i = 0; i < cn; i++)

{

// The sum is the accumulation of all the (quantities * prices).

sum += items[i].itemPrice*items[i].itemQuantity;

}

cout << "sum value on hand: " << sum << endl;

break;

// Save the inventory data in the given file

case 5:

for (int i = 0; i < cn; i++)

{

if (i == cn - 1)

{

fout << items[i].itemName << " \t" << items[i].itemNumber << " \t" << items[i].itemPrice << " \t" << items[i].itemQuantity;

}

else

{

fout << items[i].itemName << " \t" << items[i].itemNumber << " \t" << items[i].itemPrice << " \t" << items[i].itemQuantity << endl;

}

}

break;

// Read the data from the file

case 6:

while (!(inventoryFile.eof()))

{

inventoryFile >> a;

inventoryFile >> b;

inventoryFile >> inputBuffer;

c = atof(inputBuffer.c_str());

inventoryFile >> inputBuffer;

d = atoi(inputBuffer.c_str());

// Dsiplays the data in the file

cout << a << " " << b << " " << c << " " << d << endl;

}

break;

}

// Check the menu choice is not equal to 0,

//if it is equal exit from the loop

} while (mnuChoice != 0);

// File closed

fout.close();

inventoryFile.close();

}

// If the inventory file does not exist

// and then display the error message.

else

{

cout << "File does not exist!" << endl;

}

return 0;

}

See more about C++ code at brainly.com/question/17544466

#SPJ1

Other Questions
2. The name of the 1500-meter gold medal winner for each of the Olympics from 1896 to 2000 is placed in a jar. (If a man has won the race more than once, his name will be included for each race he won.) A. If one name is drawn from the jar, which country has the best chance of having a name drawn? B. Three names are drawn without replacing the name after it is drawn. What is the probability that the three winners will be from either New Zealand or Australia? pLEASE HELP (0, 9)What is the equation of a line that is parallel to y = 6x + 7 and passes through (0,Enter your equation in the box. If vertex U is located at (-4, 5) and vertex V is located at (-6, 2), then vertex U is located at Read the following passage:He sighed and looked about him. "This is no world for men," he said. "And yet in a way--it appeals."He became silent for a time, then commenced his meditative humming.In the excerpt above, the reader can infer that:Mr. Cavor is upset that the moon is not like earth.Mr. Cavor is a deeply religious man.Mr. Cavor is feeling light-headed.Mr. Cavor is thinking about staying on the moon. the magnitude of an impulse produced by a 300 g mass rubber ball, striking a wall horizontally at a velocity of 40 m/s, that rebounds with the same velocity immediately upon striking.24.0 N s12.0 N s12,000.0 N s60.0 N s What are the key points of inherited and acquired traits?For revision Select the correct answer.Sterling Company is testing the popularity of two products in the first days following their release. The quantity sold for Product 1,t days after its initial release, is modeled by the following function.g(t)= 200(1.36)The quantity sold for Product 2, t days after its initial release, is shown in the following table.5859t012 3 4f(t) 250 320 410 524 671Based on this information, which product had the greater average rate of increase in sales after three days?O Product 1Both had the same average rate of increase in sales.This cannot be determined from the given information.O Product 2Submit 93axy - 124ax - 62axy Which of the following is not an example of like terms?A. 2 and-6B.2b and-6bC.2b and 2D.2b and 6b 2. WHAT IF? A random sample of 8 speeding tickets issued in State C has a median of $120. Can you conclude that a speeding ticket in State C costs more than in States A and B? Explain. what about the geometric The selling price of a second hand car is originally N273.000. The dealer reduces the pricein the ratio of 11:13; what is the new selling price of the car?(a) 273,000 (b) 231,000 (c) 200,000 (d) 50,000 Territorial courts are basically the same as _____. Find the image vertices for a dilation with center Please help!! Thank you so much if you do!! Jayla bought the ingredients to make chicken soup, and wanted to make a double batch, which would be 12 cups of soup. prototypes remain largely unchanged throughout the design process. true or false? SERIOUS I NEED HELPIdentify the fallacy as evident in Person Bs words.Person A: I'm looking for a reliable car.Person B: Oh... the all-solar Tesla Technica is the one for you! It comes in eight bold colors, goes from 0 to 60 in three seconds, and is equipped with a large touch screen! what is the fallacy ? If you were modeling the impact of the introduction of computer automation into manufacturing on a production possibilities frontier (PPF) with two manufactured goods on their respective axes, it would be more likely that the result would be ________. A 0.10 kg mass is oscillating at a small angle from a light string of length 0.10 m.What is the period of the pendulum? A rectangle has a length of 6x-5y+1 if the perimeter of the rectangle is 16x-4y-4 determine an expression for its width