Language: C++ (Please show output)
Part 1 - LIST
Create an unsorted LIST class. Each list should be able to store 100 names.
Part 2 - Create a Class ArrayListClass
It will contain an array of 27 "list" classes.
Next, create a Class in which is composed a array of 27 list classes.
Ignore index 0... Indexes 1...26 correspond to the first letter of a Last name.
Again - ignore index 0. index 1 is names starting with A, index 2 is B, index 3 is C... index 26 is Z.
Create a file of 260 random ordered last names... 10 each for each letter… FileName: Names.txt
Have an constructor function that Reads in the Names.txt file, one name at a time, store/add each Name in the correct index LIST element.
( See File I/O lecture - this week if you need a review of File I/O - Do NOT turn in exercises in FILE I/o lecture)
Write a function that can Search for a Name to see if it in the LIST class.
Write a function that will print out the names starting with a specific letter, prints just ONE list.
Write a Function that can print out the ALL names found on each list..
HUGE HINT.. create a LIST class first, each that can hold 10 names.. Then create a class the can hold an array of 27 list classes.
//Your cpp Code
#include<bits/stdc++.h>
using namespace std;
string Last(string p){
int i,l=p.size();
string k;
for( i = 0 ; i < l ; i++ ){
if(p[i] == ' ')
k="";
else
k+=p[i];
}
return k;
}
class LIST{
list<string> List;
public :
void push(string name){
(this->List).push_back(name);
}
int Size(){
return
(this->List).size();
}
void print(){
list <string> :: iterator
it;
for(it =
(this->List).begin(); it != (this->List).end(); ++it)
cout
<<*it<<" ";
}
bool check(string name){
list <string> :: iterator
it;
for(it =
(this->List).begin(); it != (this->List).end(); ++it)
if(name ==
*it)return true;
return false;
}
};
class ArrayListClass{
LIST arr[27];
public :
ArrayListClass(){
ifstream fin;
fin.open("Names.txt");
if(!fin){
printf("Error in
file opening\n");
}else{
printf("File is ready to
read\n");
while(fin){
string
name;
getline(fin,name);
if(name.size()
> 0){
//cout<<name<<endl;
string
s=Last(name);
int n =
(int)s[0];
(this->arr[n-'A'+1]).push(name);
}
}
fin.close();
}
}
void printAll(){
for( int i =1 ; i < 27 ; i++
){
printf("Names at
index %d : ",i);
(this->arr[i]).print();
cout<<endl;
}
}
void print(int n){
printf("Names
with %c : ",n+'A'-1);
(this->arr[n]).print();
cout<<endl;
}
bool check(string name,string s){
int n = (int)s[0];
return
(this->arr[n-'A'+1]).check(name);
}
};
int main(){
ofstream fout;
fout.open("Names.txt");
string s="";
int i,j,m;
if(!fout){
printf("Error in creating
file\n");
}else{
for( i = 0 ; i < 260 ; i++ ){
s += 'A' + (i/10);
for( m =1 ; m < 10 ; m++
){
j =
rand()%26;
s +=
'A'+j;
}
fout<<s<<"\n";
s="";
}
}
printf("File is created\n");
fout.close();
ArrayListClass obj;
printf("Enter name to search\n");
getline(cin,s);
if(obj.check(s,Last(s))){
printf("Present\n");
}
else{
printf("Not Present\n");
}
printf("Enter character to print name with that
character\n");
getline(cin,s);
s=Last(s);
obj.print(s[0]-'A'+1);
obj.printAll();
return 0;
}
//Screenshot of my editor



//Screenshot of my ouput terminal

//You can also give your input file.For this file creation part needs to be commented.
Before runnig this make sure In same folder there is not file with name Names.txt
//IF you have any doubt.Please feel free to ask.
Thanks
Language: C++ (Please show output) Part 1 - LIST Create an unsorted LIST class. Each list...
in C++: Create a class named Student that has three member variables: name - string that stores the name of the student numClasses - integer that tracks how many courses the student is currently enrolled in, this number must be between 1 and 100. classList - an array of strings of size 100 used to store the names of the classes that the student is enrolled in Write the appropriate constructor(s), mutator and accessor functions for the class along with...
c++
driver and car are independed classes
1. Create a class Car, which has a color, engine, horsepower, fuel, FuelLevel, year of manufacturing and driver which can be defined by name, age, licenseNumber. Create the corresponding OOP in For each class (Driver, Car) write a header file and the class implementation -In the main function do the following: from that class in main function. L.1 Write a function that will print the total number of objects created 12 Define an...
Implement the following class in interface and implementation files. A separate file (the main project file) shall have the main function that exercises this class. Create a class named Student that has three member variables: name - string that stores the name of the student numClasses - integer that tracks how many courses the student is currently enrolled in, this number must be between 1 and 100 ClassList - an array of strings of size 100 used to store the...
Part (A) Note: This class must be created in a separate cpp file Create a class Employee with the following attributes and operations: Attributes (Data members): i. An array to store the employee name. The length of this array is 256 bytes. ii. An array to store the company name. The length of this array is 256 bytes. iii. An array to store the department name. The length of this array is 256 bytes. iv. An unsigned integer to store...
c++. please show screenshots of output
This project will continue to familiarize the student with using arrays. Store all the function proto-types in project11_funch and store all the functions in project11_func.cpp. Make sure you have proper header comments in each.h,.cpp file. When you run your program, your sample output should show your name. Your report should include the following: 1) project11_func.h 2) project11_func.cpp 3) project11.cpp 4) sample output Write the following functions: a) void fill_array_with_random_nums(int array(), int N): Fill array...
Java using data structures The objective is to create your own Hash Table class to hold a list of employees and their ID numbers. I've provided the TableEntry class which will be each data object in the hash table. The list of employees will be provided as a .txt file and must be read with the code. please create a .txt file called Employees.txt with the info provided so that the java code can read it in. Employees.txt: (No WhiteSpace...
We are using blueJ for my java class, if you can help me id
greatly appreciate it.
Create a new Java class called AverageWeight. Create two arrays: an array to hold 3 different names and an array to hold their weights. Use Scanner to prompt for their name and weight and store in correct array. Compute and print the average of the weights entered using printf command. Use a loop to traverse and print the elements of each array or...
We use bluej for our JAVA
class. If you can help me id greatly appreciate it.
Create a new Java class called AverageWeight. Create two arrays: an array to hold 3 different names and an array to hold their weights. Use Scanner to prompt for their name and weight and store in correct array. Compute and print the average of the weights entered using printf command. Use a loop to traverse and print the elements of each array or use...
c++ please Given the following skeleton of an unsorted list class that uses an unsorted linked list: template<class ItemType> struct NodeType { ItemType item; NodeType* next; }; template<class ItemType> class UList { public: UList(); // default constrctor UList(const UList &x); // we implement copy constructor with deep copy UList& operator = (UList &x); // equal sign operator with deep copy bool IsThere(ItemType item) const; // return true of false to indicate if item is...
IN JAVA USING ECLIPSE The objective of this assignment is to create your own hash table class to hold employees and their ID numbers. You'll create an employee class to hold each person's key (id number) and value (name). Flow of the main program: Create an instance of your hash table class in your main method. Read in the Employees.txt file and store the names and ID numbers into Employee objects and store those in your hash table using the...