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
Aloiza [94]
3 years ago
5

Implement the following logic in C++, Use appropriate data types. Data types are represented as either numeric (num) or string.

Computers and Technology
1 answer:
ICE Princess25 [194]3 years ago
6 0

Answer:

Follows are the modified code in c++ language:

#include<iostream>//header file

#include<string>//header file

using namespace std;

int main()//main method

{

string name,address, MSG_YES, MSG_NO;//defining string variable

int item,quantity,size=6, i=0;//defining integer variable

double price;//defining double variable  

int VALID_ITEM[]={106,108,307,405,457,688};//defining integer array and assign value

double VALID_ITEM_PRICE[]={0.59,0.99,4.50,15.99,17.50,39.00};//defining double array and assign value

bool foundIt=false;//defining bool variable  

MSG_YES="Item available";//use string variable to assign value

MSG_NO = "Item not found"; //use string variable to assign value

cout<<"Input name: ";//print message

cin>>name;//input value in string variable

cout<<"Input Address: ";//print message

cin>>address;//input value in string variable

cout<<"Input Item: "<<endl;//print message

cin>>item;//input value in string variable

cout<<"Input Quantity: "<<endl;//print message

cin>>quantity;//input value in string variable

while(i <size)//defining while that checks i less then size  

{

if (item ==VALID_ITEM[i]) //use if block to match item in double array

{

foundIt = true;//change bool variable value

price = VALID_ITEM_PRICE[i];//hold item price value in price variable  

}

i++;//increment the value of i

}

if (foundIt == true)//use if to check bool variable value equal to true

{

cout<<MSG_YES<<endl;//print value

cout<<"Quantity "<<quantity<<" at "<<"Price "<<price<<"each"<<endl;//print value

cout<<"Total"<<quantity*price;//calculate the total value

}

else//else block

cout<<MSG_NO;//print message  

}

Output:

please find the attached file.

Explanation:

In the above given C++ language modified code, four-string variable " name, address, MSG_YES, and MSG_NO", four integer variable "item, quantity, size, and i", and "integer and double" array is defined, that holds values.

In the string and integer variable "name, address, and item, quantity", we input value from the user-end and use the while loop, which uses the if block to check the "item and quantity" value from the user end and print its respective value.

You might be interested in
A client contacted you to request your help in researching and supplying the hardware necessary to implement a SOHO solution at
erastova [34]

Answer:

The correct answer to the following question will be "DHCP server".

Explanation:

A network manager that dynamically supplies and delegates equipment of clients with their IP addresses, standard portals and some other networking specifications, known as DHCP server.

  • It depends on the standard operating procedure classified as Dynamic Host Configuration Protocol to answer to client-specific broadcasting commands.
  • It's used to optimize the authentication mechanism of computers on IP channels, enabling them using applications and services including NTP, DNS, and any UDP or TCP-based networking protocol.

Therefore, the DHCP server is the right answer.

7 0
3 years ago
Files and e-mail messages sent over the Internet are broken down into smaller pieces called _____.
Fynjy0 [20]
Files and email messages sent over the internet are broken down into smaller pieces called packets
6 0
3 years ago
Question 8 of 25
denis23 [38]

Answer:

D to Protect sensitive data, Enterprise has certain security features and is mostly used in business settings.

5 0
2 years ago
Importance/Role of the information systems in Education​
JulsSmile [24]

Answer:

Information technology can be used to promote opportunities for knowledge dissemination.

Explanation:

It can help the teachers and students have up-to-date information and knowledge. The accurate and right information is necessary for effective teaching and learning; and information technology

7 0
2 years ago
Is the ipv6 address 2001:1d5::30a::1 a valid address? why or why not?
defon
<span>Not a valid IPv6 address A valid IPv6 address consist of 8 groups of 4 hexadecimal numbers separated by colons ":". But that can make for a rather long address of 39 characters. So you're allowed to abbreviate an IPv6 address by getting rid of superfluous zeros. The superfluous zeros are leading zeros in each group of 4 digits, but you have to leave at least one digit in each group. The final elimination of 1 or more groups of all zeros is to use a double colon "::" to replace one or more groups of all zeros. But you can only do that once. Otherwise, it results in an ambiguous IP address. For the example of 2001:1d5::30a::1, there are two such omissions, meaning that the address can be any of 2001:1d5:0:30a:0:0:0:1 2001:1d5:0:0:30a:0:0:1 2001:1d5:0:0:0:30a:0:1 And since you can't determine which it is, it's not a valid IP address.</span>
6 0
3 years ago
Other questions:
  • Every application program has a _______________ segment
    6·1 answer
  • Jenny wants to create a résumé after a two-years gap. What should she consider?
    11·2 answers
  • How does a hard drive work?
    5·1 answer
  • An adiabatic capillary tube is used in some refrigeration systems to drop the pressure of the refrigerant from the condenser lev
    15·1 answer
  • Translation of a file into a coded format that occupies less space than the original file is called
    15·1 answer
  • You have a chart that shows 100 data points and you've circled the highest value. Which of the following are you using?
    8·1 answer
  • A report has a column of totals, with each total adding to the cell above it. What kind of calculated figure is this?
    15·1 answer
  • Please as soon as possible
    13·1 answer
  • Create a function called is_list_empty that takes a single argument of type list. Your function should return True if the list i
    7·1 answer
  • Why is lateral reading an important tool when reading material in social media or any online source
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!