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
stiv31 [10]
3 years ago
6

In this module you learned about searching, sorting and algorithms in C++ and how to implement these elements in your C++ progra

ms. In this assignment you will implement your knowledge of searching, sorting and algorithms for charge account validation system. Write a program that lets the user enter a charge account number. Be sure to include comments throughout your code where appropriate. The program should determine if the number is valid by checking for it in the following list of valid account numbers:
814942053331743080098675596395269814449539938719751047262931356428263717502196086650316483824195904578589971890467499412545408Initialize a one-dimensional array with these values. Then use a simple linear search to locate the number entered by the user. If the user enters a number that is in the array, the program should display a message indicating that the account number is valid. If the user enters a number not in the array, the program should display a message indicating it is invalid.Next, using the same one-dimensional array, use a bubble-sort to put the array in order and perform a binary search to locate the number entered by the user. If the user enters a number that is in the array, the program should display a message indicating that the account number is valid. If the user enters a number not in the array, the program should display a message indicating it is invalid.
Engineering
1 answer:
alisha [4.7K]3 years ago
3 0

Question is not well presented:

The search strings in the question are not well formatted.

First thing, I'll arrange the account number in order of 7;

Meaning that the length of each account number is 7

8149420 5333174 3080098 6755963 9526981 4449539 9387197 5104726 2931356 4282637 1750219 6086650 3164838 2419590 4578589 9718904 674994 12545408

Answer:

// This program is written in C++ Programming Language

// Comments are used for explanatory purpose

// Program starts here

#include <iostream>

using namespace std;

// Initialise Function

int ArrayList(int[], int, int);

// Main Method starts at

int main()

{

// The list of account is 18; so, we Initialise an integer Variable to hold this value

const int acctlist = 18;

// Initialise an array to hold the account numbers

int List[acctlist] = { 8149420 5333174 3080098 6755963 9526981 4449539 9387197 5104726 2931356 4282637 1750219 6086650 3164838 2419590 4578589 9718904 674994 12545408

};

// Declare account number and search result Variables of type integer

int accountnumber, Result;

// Prompt user for account number

cout << "Enter a valid account number: ";

cin >> accountnumber;

// Determine if valid or not

Result = ArrayList(List, acctlist, accountnumber);

if(Result == -1){

cout << "Account number " << AcctNum << " is invalid.\n";}

else{

cout << "Account number " << List[Result] << " is valid\n";

}

return 0;

}

// Function starts here

int ArrayList(int list[], int size, int value)

{

int index = 0,

pos = -1;

bool seen = false;

// Check if Account number is seen in list

while (!seen && index < size)

{

if (list[index] == value)

{

seen = true;

}

pos = index;

}

index++;

}

return pos;

}

You might be interested in
Nearlyof all serious occupational injuries and illnesses stem from overexertion of repetitive motion.
Ostrovityanka [42]

Answer:

a) 1/2

Explanation:

Overexertion accounted for more than  half of all events that resulted in a disabling condition.

Furthermore, 30% of all overexertion cases were reported in the services industry, on the other hand, 25% of injuries resulting from contact with objects and  equipment occurred in the manufacturing industry.

The above piece of information is taken from the bureau of labor statistics, Survey of Occupational Injuries and Illnesses

"LOST-WORKTIME INJURIES AND ILLNESSES: CHARACTERISTICS  AND RESULTING DAYS AWAY FROM WORK, 2002"

8 0
4 years ago
Discuss in detail the following methods used to redistribute income and wealth in cash grants?​
aev [14]

Answer:

Redistribution of income and wealth is the transfer of income and wealth (including physical property) from some individuals to others through a social mechanism such as taxation, welfare, public services, land reform, monetary policies, confiscation, divorce or tort law.

-The term typically refers to redistribution on an economy-wide basis rather than between selected individuals.

Interpretations of the phrase vary, depending on personal perspectives, political ideologies and the selective use of statistics.

-It is frequently heard in politics, usually referring to perceived redistribution from those who have more to those who have less. Occasionally, however, it is used to describe laws or policies that cause opposite redistribution that shift monetary burdens from low-income earners to the wealthy.

-

The phrase is often coupled with the term class warfare, with high-income earners and the wealthy portrayed as victims of unfairness and discrimination.

-

Redistribution tax policy should not be confused with predistribution policies. "Predistribution" is the idea that the state should try to prevent inequalities from occurring in the first place rather than through the tax and benefits system once they have occurred. For example, a government predistribution policy might require employers to pay all employees a living wage, not just a minimum wage, as a "bottom-up" response to widespread income inequalities or high poverty rates.

Many alternate taxation proposals have been floated without the political will to alter the status quo. One example is the proposed "Buffett Rule", which is a hybrid taxation model composed of opposing systems, intended to minimize the favoritism of the special interest tax design.

7 0
3 years ago
90% of traffic crashes are due to driver error.<br> True<br> False
kumpel [21]

90% of traffic crashes are due to driver error.

True

3 0
2 years ago
Read 2 more answers
Consider a continuous-flow, indraft supersonic wind tunnel, which uses a vacuum pump to draw atmospheric air from outside of the
BigorU [14]
I believe it’s B but I’m not sure
3 0
3 years ago
A body of weight 300N is lying rough
kumpel [21]

Answer:

Horizontal force = 89.2 N

Explanation:

The frictional force = coefficient of friction * magnitude of the force (weight of the body) * cos theta

Substituting the given values, we get -

Frictional Force = 0.3*300 * cos 25 = 89.2 N

Horizontal force = 89.2 N

6 0
3 years ago
Other questions:
  • An air conditioner using refrigerant R-134a as the working fluid and operating on the ideal vapor-compression refrigeration cycl
    12·1 answer
  • When a group of firms chooses to work together to turn a non-monopoly market into a monopoly market by securing formal agreement
    8·1 answer
  • Does the army good 4 you
    15·1 answer
  • What is best for electrical engineer​
    12·2 answers
  • The organic acid, ACOOH, reacts reversibly with the alcohol BOH, to form the ester ACOOB according to the stoichiometric equatio
    6·1 answer
  • If you are in a tornado situation, which of the following actions would put you in danger?
    11·1 answer
  • Describing Tasks for Stationary Engineers Click this link to view O*NET’s Tasks section for Stationary Engineers. Note that comm
    12·2 answers
  • W
    7·1 answer
  • 8. What are used by the project architect to depict different building systems and to show how they correlate to one anothe
    14·1 answer
  • The source term will affect all algebraic equations.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!