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
IrinaK [193]
2 years ago
11

class llist { private: record * start; char filename[16]; int readfile(); int writefile(); record * reverse(record * ); void cle

anup(); public: llist(); llist(char[]); ~llist(); int addRecord(int, char [ ],char [ ]); int printRecord(int); // replace printAllRecords() with the << operator int modifyRecord(int, char [ ]); int deleteRecord(int); void reverse(); };
Computers and Technology
1 answer:
Sophie [7]2 years ago
8 0

Answer:

See Explaination

Explanation:

#include <cstdlib>

#include <iostream>

#include <iomanip>

#include <fstream>

#include <string>

#include <sstream>

using namespace std;

struct Person

{

string name;

string addr;

string phone;

string id;

};

const int MAX_SIZE = 8;

void addData(Person list[], int& size);

void dispData(const Person list[], int size);

void delData (const Person list[], int size);

void saveFile(const Person list[], int size);

void openFile(Person list[], int& size);

char getMenuResponse();

int main(int argc, char *argv[])

{

Person contactList[MAX_SIZE];

int numOfRecs = 0;

bool run = true;

do

{

cout << "Address Book - " << numOfRecs << " Number of Contacts" << endl;

switch ( getMenuResponse() )

{

case 'A': addData(contactList, numOfRecs); break;

case 'D': dispData(contactList, numOfRecs); break;

case 'T': delData(contactList, numOfRecs); break;

case 'O': openFile(contactList, numOfRecs); break;

case 'S': saveFile(contactList, numOfRecs); break;

case 'Q': run = false; break;

default : cout << "That is NOT a valid choice" << endl;

}

} while (run);

cout << endl << "Program Terminated" << endl;

return EXIT_SUCCESS;

}

void addData(Person list[], int& size)

{

Person tmp;

char response;

char str[256];

if (size < MAX_SIZE) {

system("cls");

cout << "Enter Contact Information" << endl << endl;

cout << "Name: ";

cin.getline(str, 256, '\n');

tmp.name = str;

cout << endl;

cout << "Address: ";

cin.getline(str, 256, '\n');

tmp.addr = str;

cout << endl;

cout << "Phone Number: ";

cin.getline(str, 256, '\n');

tmp.phone = str;

cout << endl;

cout << "E-mail id Address: ";

cin.getline(str, 256, '\n');

tmp.id = str;

cout << endl;

cout << "Add Contact to Address Book? (y/n) ";

cin >> response;

if (toupper(response) == 'Y')

list[size++] = tmp;

} else {

cout << "Sorry, Address Book is currently full." << endl;

system("pause");

}

system("cls");

}

void dispData(const Person list[], int size)

{

system("cls");

if(size < 1)

{

cout << "Nothing to display" << endl;

} else {

cout << "Contacts :" << endl << endl;

cout << fixed << setprecision(2);

cout << "Contact Name Address Phone No. ID" << endl;

cout << left;

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

{

cout << setw(10) << list[i].name << right

<< setw(10) << list[i].addr<<right

<< setw(10) << list[i].phone<<left

<< setw(15) << list[i].id<<left<<endl;

}

cout << right << setw(3) << size;

cout << " Contacts"<< endl;

}

system("PAUSE");

system("cls");

}

void delData(const Person list[],int size) {

vector<Person> :: iterator vItr = Contact.begin();

while (vItr != Contact.end() )

{

if (vItr->Name == Name)

{

vItr = Contact.erase (vItr);

break;

}

else

vItr++;

}

void saveFile(const Person list[], int size) {

string fileName;

ofstream outfi;

cout<<"Enter file name: ";

getline(cin,fileName);

outfi.open(fileName.c_str());

if (!outfi.fail()) {

system("cls");

cout << "Saving Address Book to the disc ";

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

outfi << list[i].name << ';'

<< list[i].addr<< ';';

if (i < size-1) outfi << endl;

}

cout << endl << size << " Address Book in the disc." << endl;

outfi.close();

system("PAUSE");

system("cls");

}

else {

cout << "ERROR: problem with file" << endl;

system("PAUSE");

system("cls");

}

}

void openFile(Person list[], int& size)

{

ifstream infi("AddressBook.txt");

string str;

stringstream strstrm;

if (!infi.fail()) {

system("cls");

cout << "Reading Address Book from the disc ";

size = 0;

while(!infi.eof() && size < MAX_SIZE)

{

getline(infi, str, ';');

list[size].name = str;

getline(infi, str, ';');

strstrm.str(""); strstrm.clear();

strstrm << str;

strstrm >> list[size].addr;

}

cout << endl << size << " read contacts from the disc." << endl;

system("PAUSE");

system("cls");

}

else {

cout << "ERROR :file not accepted" << endl;

system("PAUSE");

system("cls");

}

}

char getMenuResponse()

{

char response;

cout << endl << "take chioce" << endl

<< "(A)dd contact, (D)isplay contact0, (O)pen File, (S)ave File, (Q)uit" << endl

<< "> ";

cin >> response;

cin.ignore(256, '\n');

return toupper(response);

}

You might be interested in
Nog
STatiana [176]

Answer: False

Explanation:

The statement that "Peacekeeper text is non-printing text that indicates where you can type" is false.

The non-printing text which shows where on exam type is referred to as the peaceholder text. It is usually an hint which can be used to fill in the actual text.

8 0
3 years ago
Understanding Sequential Statements Summary
Kisachek [45]

Answer:

// Payroll.java

public class Payroll

{

int numOfDependents;

double salary;

double salaryToHome;

double Federal_Tax,TAX_RATE,Depen_tax;

 

Payroll(double salry,int nod)

{

numOfDependents=nod;

salary=salry;

Federal_Tax=6.5;

TAX_RATE=28.0;

Depen_tax=2.5;

}

 

double getTAX_RATE()

{

return TAX_RATE*salary/100;

}

double Federal_Tax()

{

return Federal_Tax*salary/100;

}

double getDepenAmount()

{

return numOfDependents*(Depen_tax*salary/100);

}

double getTakeHomeSalary()

{

return salary+getDepenAmount()-(getTAX_RATE()+Federal_Tax());

}

void printOutput()

{

System.out.print("\nState Tax: $"+getTAX_RATE());

System.out.print("\nFederal Tax: $"+Federal_Tax());

System.out.print("\nDependents: $"+getDepenAmount());

System.out.print("\nSalary: $"+salary);

System.out.println("\nTake Home Pay: $"+getTakeHomeSalary());

 

}

public static void main(String args[])

{

Payroll obj=new Payroll(1250,2);

obj.printOutput();

}

}

// ModifiedPayroll.java

import java.util.Scanner;

public class ModifiedPayroll

{

 

int numOfDependents;

double salary;

double salaryToHome;

double Federal_Tax,TAX_RATE,Depen_tax;

 

ModifiedPayroll(double salry,int nod)

{

//initialise variables

numOfDependents=nod;

salary=salry;

Federal_Tax=6.5;

TAX_RATE=28.0;

Depen_tax=2.5;

}

 

double getTAX_RATE()

{

return TAX_RATE*salary/100;

}

double Federal_Tax()

{

return Federal_Tax*salary/100;

}

double getDepenAmount()

{

return numOfDependents*(Depen_tax*salary/100);

}

double getTakeHomeSalary()

{

return salary+getDepenAmount()-(getTAX_RATE()+Federal_Tax());

}

void printOutput()

{

System.out.print("\nState Tax: $"+getTAX_RATE());

System.out.print("\nFederal Tax: $"+Federal_Tax());

System.out.print("\nDependents: $"+getDepenAmount());

System.out.print("\nSalary: $"+salary);

System.out.println("\nTake Home Pay: $"+getTakeHomeSalary());

 

}

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("\nEnter Salary: $");

double salary=sc.nextDouble();

System.out.print("\nEnter number Of Dependents:$");

int nob=sc.nextInt();

ModifiedPayroll obj=new ModifiedPayroll(salary,nob);

obj.printOutput();

}

}

Explanation/Output:

// For Payroll.java

State Tax: $350.0

Federal Tax: $81.25

Dependents: $62.5

Salary: $1250.0

Take Home Pay: $881.25

// For ModifiedPayroll.java

Enter Salary:$1550.0

Enter number of Dependents:$3

State Tax: $434.0

Federal Tax: $100.75

Dependents: $116.25

Salary: $1550.0

Take Home Pay: $1131.5

8 0
3 years ago
How do nations mostly use technology in foreign relations? Check all that apply.
Andreas93 [3]

Answer:

  • to spy on one another
  • to carry out cyber attacks
  • to improve their public images

Explanation:

Different countries have tools to hack, control and filter information in foreign countries using different devices and techniques that allow them to be aware of any threat that may arise from another country, as well as obtaining information that helps them.

By linking technology with foreign policy, it is possible to strengthen and complement national capacities in these areas, opening the possibility of diversifying and expanding the projection of a country with an excellent image that offers sophisticated technology-based services.

5 0
3 years ago
Company ABC has always used passwords to protect the highly confidential information in their company. Recently, someone who was
Leno4ka [110]
Company ABC should use passwords but also have them use a code so that not just anyone can get in. Kinda like facebook.
3 0
3 years ago
Define the following terms: Line authority,in your own words.
konstantin123 [22]
The power given to a person in a supervisory position who makes decisions and actions by subordinates. An engineer manager is an example of like authority.
7 0
2 years ago
Other questions:
  • How useful do you find the creation of folders in your computer?
    8·2 answers
  • 3-Write a program in some language that has both static and stack dynamic local variables in subprograms. Create six large (at l
    9·2 answers
  • A(n) _____ measures the ability to juggle a variety of demands, as in a manager's job where the candidate is presented with simu
    8·1 answer
  • It's possible to __________ out of a loop if the user has entered an incorrect value that would cause an error or a problem with
    11·1 answer
  • Pro and Cons of Artificial Intelligence in Art <br><br> You must have 3 statements in each
    14·1 answer
  • Imagine a machine that produces an output force that is five times larger
    11·1 answer
  • Professional communication must be objective,
    8·1 answer
  • Alice recently purchased a new cell phone. After her vacation, Alice wanted to transfer her holiday photos to her computer to do
    8·1 answer
  • Now that you have learned the basics of acquiring relevant information through research, it's time to put your skills to work.
    7·1 answer
  • A. Modify the FitnessTracker class that includes data fields for a fitness activity, the number of minutes spent participating,
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!