To write a program that implements the following C++ concepts 1. Data Encapsulation 2.
Instantiate classes 3. Composition Class 4. Aggregation Class 5. Dynamic Memory 6. File
Stream Make a program that reads a file and can generate reports. Each file will have phone calls
records (see section 4). The program will process the data gathering all minutes and total amount
for each report. The program should have a menu (see section 1): 1. New Report – this option
will ask a file name (TE??????.tel). This option will instantiate an object of Report class, loading
the whole file into memory. 2. Delete a report – this option will display all reports available in
memory and ask which one you would like to delete. 3. Display a report – this option will
display all reports available in memory and ask you which one you would like to generate a
report. 4. Exit – Program ends. For option 1, you do not know how many reports are, meaning
that you will create dynamically the reports. For long distance calls the formula will be (minutes
call x $1.50). For local phone calls the formula will be (minutes call x $0.25)
--------------------------------------------------------------------------------------------------------------------
----------------------------
//Main.cpp
*#define between(x,y,z) ((x>=y && x<=z)? true:false)
#include
#include
#include
#include \"Data.h\"
#include \"Report.h\"
#include \"Menu.h\"
using namespace std;
//uses class Report to create reports
//uses class Menu to display a menu to choose
int main() {
int idx = 0;
int count = idx;
Menu menu(\"Reports\");
Data temp;
string fileName;
Report* phoneCompany;
Report* newReport(Report*, int&);
Report* deleteReport(Report*, int&, int);
int displayReport(Report*, int);
bool fileNameExists(string);
menu.addMenuItem(\"New Report\");
menu.addMenuItem(\"Delete a Report\");
menu.addMenuItem(\"Display a Report\");
ofstream openFile;
phoneCompany = NULL;
phoneCompany = new Report[count];
do {
cout << menu;
cin >> menu;
switch (menu.getChoice()) {
case \'1\':
cout << \"\ \\tEnter report name (TE??????): \";
cin >> fileName;
openFile.open(fileName + \".tel\");
if (openFile.good()) {
cout << \"\ \\tReport succesfully created.\ \";
phoneCompany[count].setFileName(fileName);
count++;
}
else {
cout << \"\ \\terror: Could not create report.\ \";
}
break;
case \'2\':
if (count != 0) {
do {
system(\"cls\");
cout << \"\ \ \\tDelete a Report:\ \ \";
idx = displayReport(phoneCompany, count);
if (between(idx, 0, count - 1)) {
phoneCompany = deleteReport(phoneCompany, count, idx);
idx = 0;
}
else
cout << \"\ \\terror: Report could not be deleted.\ \";
} while (idx != count);
}
else {
cout << \"\ \ \\tNo reports to delete.\ \ \";
system(\"pause\");
}
break;
case \'3\':
if (count != 0) {
do {
system(\"cls\");
cout << \"Display a Report:\ \ \";
idx = displayReport(phoneCompany, count);
system(\"cls\");
cout << \"\ \\t\" << phoneCompany[idx].getFileName();
cout << \"\ \ \\tWould you like to edit the report?\";
cout << \.
The purpose of this C++ programming project is to allow the student .pdfRahul04August
The purpose of this C++ programming project is to allow the student to perform parallel array
and multidimensional array processing. The logic for string and Cstring has already been
completed, so the assignment can be started before we actually cover string and Cstring in detail.
This program has the following three menu options:
Solution
/*
This program uses simple arrays, multidimensional arrays, cstrings, strings, and files.
It allows a payroll clerk to choose an option from a menu. The choices are:
A: List the Payroll Information by Employee Name
B: Search Payroll Information by Employee Name
X: Exit the Payroll Information Module
The following items for each employee are saved in the file p10.txt:
Employee ID (1000 - 9999)
Last Name (15 characters)
First Name (15 characters)
Rate (5.00 - 10.00)
Hours W1,W2,W3,W4 (0-60)
*/
#include // file processing
#include // cin and cout
#include // toupper
#include // setw
#include // cstring functions strlen, strcmp, strcpy stored in string.h
#include // string class
#define stricmp strcasecmp
#define strnicmp strncasecmp
using namespace std;
//Disable warning messages C4267 C4996.
//To see the warnings, comment out the following line.
//#pragma warning( disable : 4267 4996)
//Warning C4267: coversion from size_t to int, possible lost of data
//size_t is a data type defined in and is an unsigned integer.
//The function strlen returns a value of the type size_t, but in
//searchByName we assign the returned value to an int.
//We could also declare the variable as size_t instead of int.
// size_t stringLength;
//Warning C4996: strnicmp strcpy, stricmp was declared deprecated, means
//the compiler encountered a function that was marked with deprecated.
//The deprecated function may no longer be supported in a future release.
//Global Constants
//When using to declare arrays, must be defined with const modifier
const int ARRAY_SIZE = 20, HOURS_SIZE = 4, NAME_SIZE = 16;
//Declare arrays as global so we don\'t have to pass the arrays to each function.
//Normally we wouldn\'t declare variables that change values a global.
int employeeId[ARRAY_SIZE];
string firstName[ARRAY_SIZE];
char lastName[ARRAY_SIZE][NAME_SIZE];
double rate[ARRAY_SIZE];
int hours[ARRAY_SIZE][HOURS_SIZE];
int numberOfEmps; //count of how many employees were loaded into arrays
int sumHours[ARRAY_SIZE] = {0}; //initialize arrays to zero by providing a
double avgHours[ARRAY_SIZE] = {0}; //value for the first element in the array
//Function Prototypes
void loadArray( );
void sumAndComputeAvgHours( );
void listByName( );
void searchByName( );
void sortByName( );
void swapValues(int i, int minIndex);
void listEmployees( );
void listEmployeesHeadings( );
void listEmployeesDetails(int i);
void listEmployeesTotals( );
void displayContinuePrompt( );
//Program starts here
int main()
{
//Declare and initialize local main variables
char choice; //menu option
//Load the arrays with data
loadArray();
//Sum and compute the average hours
sumAndComputeAv.
The purpose of this C++ programming project is to allow the student .pdfRahul04August
The purpose of this C++ programming project is to allow the student to perform parallel array
and multidimensional array processing. The logic for string and Cstring has already been
completed, so the assignment can be started before we actually cover string and Cstring in detail.
This program has the following three menu options:
Solution
/*
This program uses simple arrays, multidimensional arrays, cstrings, strings, and files.
It allows a payroll clerk to choose an option from a menu. The choices are:
A: List the Payroll Information by Employee Name
B: Search Payroll Information by Employee Name
X: Exit the Payroll Information Module
The following items for each employee are saved in the file p10.txt:
Employee ID (1000 - 9999)
Last Name (15 characters)
First Name (15 characters)
Rate (5.00 - 10.00)
Hours W1,W2,W3,W4 (0-60)
*/
#include // file processing
#include // cin and cout
#include // toupper
#include // setw
#include // cstring functions strlen, strcmp, strcpy stored in string.h
#include // string class
#define stricmp strcasecmp
#define strnicmp strncasecmp
using namespace std;
//Disable warning messages C4267 C4996.
//To see the warnings, comment out the following line.
//#pragma warning( disable : 4267 4996)
//Warning C4267: coversion from size_t to int, possible lost of data
//size_t is a data type defined in and is an unsigned integer.
//The function strlen returns a value of the type size_t, but in
//searchByName we assign the returned value to an int.
//We could also declare the variable as size_t instead of int.
// size_t stringLength;
//Warning C4996: strnicmp strcpy, stricmp was declared deprecated, means
//the compiler encountered a function that was marked with deprecated.
//The deprecated function may no longer be supported in a future release.
//Global Constants
//When using to declare arrays, must be defined with const modifier
const int ARRAY_SIZE = 20, HOURS_SIZE = 4, NAME_SIZE = 16;
//Declare arrays as global so we don\'t have to pass the arrays to each function.
//Normally we wouldn\'t declare variables that change values a global.
int employeeId[ARRAY_SIZE];
string firstName[ARRAY_SIZE];
char lastName[ARRAY_SIZE][NAME_SIZE];
double rate[ARRAY_SIZE];
int hours[ARRAY_SIZE][HOURS_SIZE];
int numberOfEmps; //count of how many employees were loaded into arrays
int sumHours[ARRAY_SIZE] = {0}; //initialize arrays to zero by providing a
double avgHours[ARRAY_SIZE] = {0}; //value for the first element in the array
//Function Prototypes
void loadArray( );
void sumAndComputeAvgHours( );
void listByName( );
void searchByName( );
void sortByName( );
void swapValues(int i, int minIndex);
void listEmployees( );
void listEmployeesHeadings( );
void listEmployeesDetails(int i);
void listEmployeesTotals( );
void displayContinuePrompt( );
//Program starts here
int main()
{
//Declare and initialize local main variables
char choice; //menu option
//Load the arrays with data
loadArray();
//Sum and compute the average hours
sumAndComputeAv.
Program 1 (Practicing an example of function using call by referenc.pdfezhilvizhiyan
Program 1: (Practicing an example of function using call by reference)
Write a program that reads a set of information related to students in C++ class and prints them
in a table format. The information is stored in a file called data.txt. Each row of the file contains
student number, grade for assignment 1, grade for assignment 2, grade for assignment 3, and
grade for assignment 4. Your main program should read each row, pass the grades for the three
assignments to a function called ProcessRow to calculate the average of the grades, minimum of
the four assignments, and the maximum of the four assignments. The results (average,
maximum, and minimum) should be returned to the main program and the main program prints
them on the screen in a table format. For example, if the file includes
126534 7 8 10 7
321345 5 6 4 9
324341 8 3 8 5
your program should print
Std-Id A1 A2 A3 A4 Min Max Average
----------------------------------------------------------------------------------
126534 7 8 10 7 7 10 8
321345 5 6 4 9 4 9 6
324341 8 3 8 5 3 8 6
You must use call by reference to do the above question.
_________________________________________________________________
Program 2: (Practicing an example of function using call by value)
Repeat the above question using call by value. This means you need to have three different
functions: one to calculate the average, another to calculate the minimum, and the third one to
calculate the maximum. This is how to call these functions:
Max = CalculateMax(A1,A2,A3, A4);
Min = CalculateMin(A1,A2,A3, A4);
Average = CalculateAvg(A1,A2,A3, A4);
_________________________________________________________________
Program 3:
Write a program with several functions that performs the following tasks. :
Create a function that reads the following 5 float numbers from the file data.txt into array Called
Arr1.
12.0 15.0 29.3 25.0 93.2
Copy array Arr1 into array Arr2 in reverse order
Print array Arr1.
Print array Arr2.
Find the number of elements in array Arr1 that are >= 80 and <=100.
Find the number of the elements in array Arr1 in which their contents are divisible by 5
Find the index of the elements in array Arr1 in which their contents are divisible by 3.
Find mean (average) in array Arr1.
Find the maximum number in array Arr1.
Ask the user to input a key. Then search for the key in array Arr1 and inform the user about the
existence (true / false) of the key in array
Your program should include several functions.
A function for filling up the information from file into an array (part a should call this function)
A function that does the copying of one array into another in reverse order. Arrays must have the
same size (part b should call this function)
Printing any array with any size (part c and d should call this function)
finding and returning the number of elements between 80 and 100 in any array with any size
(part e calls this function)
finding and returning the number of elements in an array that are divisible by 5 (par.
[10] Write a Java application which first reads data from the phoneb.pdfarchiespink
[10] Write a Java application which first reads data from the phonebook file here:
660749054 Iwjint, Taib
638727163 Jroch, Ov
989981308 Vihoost, Yssoub
339223911 Vokoiv, Jishar
718489075 Owut, Praint
150942045 Bryk, Bloneip
862082436 Oich, Xoipjtt
703482042 Brjsh, Nuw
921326275 Bloop, Yss
472635412 Chivoon, Toupfaipf
into an ArrayList of phonebook entries. You may download the file and have your application
load it locally or have your application download the file directly. We’ll need to differentiate
between the name and phone number when sorting and retrieving data, so each entry should
consist of separate fields for the name and phone number (e.g., a class with two private String
variables would be considered good style here).
Solution
The PhoneDirectory class:
/* An object of type PhoneDirectory holds a list of names and associated
phone numbers. In this simple implementation, both the names and the
numbers are stored as strings. The names and numbers must be non-null
strings, but no attempt is made to ensure that the values make sense.
Comparison of names is in all cases case-insensitive. A given name
cannot occur more than once in the directory. The instance methods
throw IllegalArgumentExceptions when the rules are violated.
The instance methods load() and save() are provided for loading
the data for the directory from a stream and for saving the data
to a stream.*/
import java.io.*;
public class PhoneDirectory {
/* The data for the directory is stored in a pair of arrays. The phone
number associated with the name names[i] is numbers[i]. These
arrays will grow, as necessary, to accommodate as many entries as
are added to the directory. The variable count keeps track of
the number of entires in the directory. */
private String[] names = new String[1];
private String[] numbers = new String[1];
private int count = 0;
public boolean changed; // This variable is set to true whenever a change
// is made to the data in this directory. The value
// is false when the object is created. The only time
// that it is reset to false is if the load() method
// is used to load a phone directory from a stream.
// (Programs that use the directory can also set the
// value of changed if they want, since it\'s public.)
public void load(TextReader in) throws IOException {
// Clears any entries currently in the directory, and loads
// a new set of directory entries from the TextReader. The
// data must consist of the following: a line containing the
// number of entries in the directory; two lines for each
// entry, with the name on the first line and the associated
// number on the second line. Note that this method might
// throw an IllegalArgumentException if the data in the file
// is not valid -- for example if the same name occurs twice.
// Note that if an error does occur, then the original
// data in the directory remains.
int newCount = in.getlnInt();
String[] newNames = new String[newCount + 5];
String[] newNumbers = new String[newCount + 5];
for.
Programming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdfssuser6254411
Programming For Big Data [ Submission: DvcScheduleV2.cpp and StaticArray.h and/or
DynamicArray.h ]
Assignment 5's runtime was too slow -- a couple of minutes or so. It's because of the duplicate-
checking, with over 4 billion compares.
Rewrite the duplicate-checking logic from Assignment 5, using a technique from "Techniques
For Big Data, Reading" to do fewer compares (check the term first then section number for the
duplicate check), and come up with the exact same results as Assignment 5.
You may use your StaticArray.h from Assignment 3 and/or your DynamicArray.h from
assignments 4, but you may not use any STL containers. Submit the H file(s) you use in your
solution, even if there are no changes since your previous work. Your project will be compiled
for grading using the default stack memory size of 1MB.
Since this version is supposed to be fast, there is no longer a need for a progress bar. Include one
if you wish (you may see the run time dramatically changed), or you may leave it out -- your
choice. But if you do have a progress bar, do remember to "flush"...
[Submission] - Submit the driver program (DvcScheduleV2.cpp) with the header files used
The code I wrote for previous assignment:
Main:
#include
#include
#include
#include
#include "DynamicArray.h"
using namespace std;
struct Class
{
string code;
int count;
};
int main()
{
DynamicArray sub;
DynamicArray sem;
DynamicArray sec;
int totalSubjects = 0;
int dup = 0;
int total = 0;
int counter = 0;
bool duplicate;
bool stored;
// For parsing input file
char* token;
char buf[1000];
const char* const tab = "\t";
// Open input file
ifstream fin;
fin.open("dvc-schedule.txt");
if (!fin.good())
{
cout << "I/O error. File can't be found!\n";
return 1; // Exit the program with an error code
}
// Read the input file
while (fin.good())
{
// Progress bar
if (counter % 1000 == 0)
{
cout << '.';
cout.flush();
}
duplicate = false;
stored = false;
string line;
getline(fin, line);
total++; // Total lines processed
strcpy(buf, line.c_str());
if (buf[0] == 0)
continue; // Skip blank lines
// Parse the line
const string term(token = strtok(buf, tab));
const string section(token = strtok(0, tab));
const string course((token = strtok(0, tab)) ? token : "");
const string instructor((token = strtok(0, tab)) ? token : "");
const string whenWhere((token = strtok(0, tab)) ? token : "");
if (course.find('-') == string::npos)
continue;
const string code(course.begin(), course.begin() + course.find('-'));
// Check for duplicates
for (int i = 0; i < counter; i++)
{
if (sem[i] == term && sec[i] == section)
{
dup++;
duplicate = true;
break;
}
}
if (duplicate == true)
continue;
sem[counter] = term;
sec[counter] = section;
counter++;
for (int i = 0; i < totalSubjects; i++)
{
if (sub[i].code == code)
{
sub[i].count++;
stored = true;
break;
}
}
if (stored == true)
continue;
Class y;
y.code = code;
y.count = 1;
sub[totalSubjects] = y;
totalSubjects++;
}
fin.close();
cout << endl;
for (int i = 0; i < totalSubjects; i++)
{
f.
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docxrafbolet0
Spring 2014 CSCI 111 Final exam � of �1 6
1. (2 points) Flip over this test. On the back of this test write your name in the upper, left-hand
corner.
2. (2 points) What are the four parts of the compiling process (just give me 4 words, not a
paragraph).
3. (4 points) Which of the four steps of the compiling process occurs only once, regardless of
the number of source files your application has?
4. (4 points) Write a line of code that causes the preprocessor to generate an error.
5. (4 points) Write a line of code that causes the compiler to generate an error.
6. (5 points) Describe how you could incorrectly compile the joust project to cause the linker to
generate an error.
7. (5 points) Given:
1 float* fp;
2 //...
3 float pi;
4 pi=*(314 + fp);
Rewrite line 4 using array subscript notation.
Spring 2014 CSCI 111 Final exam � of �2 6
8. (5 points) Given:
1 float arr[100];
2 for(int x=0; x<100; ++x)
3 arr[x]=100-x;
What does the following expression print out?
cout << *arr << endl;
9. (14 points) Given:
int a=0;
int b=6;
int x=0;
Circle each if-expression that evaluates to true:
A) if(b)
B) if(x)
C) if(a=b==6)
D) if(a=b==5)
E) if(a=b=5)
F) if(a=x=0)
G) if(a=x==0)
Spring 2014 CSCI 111 Final exam � of �3 6
10. (10 points) Given:
1 #include<iostream>
2 using namespace std;
3
4 int main()
5 {
6 int x;
7 cout << "Enter a number greater than 10" << endl;
8 while ( x < 10 )
9 {
10 cin >> x;
11 }
12 return 0;
13 }
This program compiles just fine, and sometimes it runs as expected. But sometimes when you
run it, it exits immediately after printing "Enter a number greater than 10". That is, the program
doesn't pause for you to enter a number. Why are you getting this inconsistent behavior?
11. (4 points) What is the output of the following:
int x=4;
int y=3;
A) cout << x / y << endl;
B) cout << x % y << endl;
C) cout << x << "%" << y << endl;
D) cout << "x" << '%' << 'y' << endl;
Spring 2014 CSCI 111 Final exam � of �4 6
12. (16 points) What is the type of the expression. That is, what is the kind of thing that each
expression evaluates to. For example:
3 + 4 integer
You may assume that the variable a has been declared as an integer.
A. a + 4
B. a = 4
C. 3.14 + 4.49
D. 3 + 3.14
E. 'a'
F. cout << a
G. new float[30]
H. new float
Spring 2014 CSCI 111 Final exam � of �5 6
13. (5 points) Write a for-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
14. (5 points) Write a while-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
15. (5 points) Write a do-while-loop that prints out the numbers between 1 and 100 that are
evenly divisible by three.
Spring 2014 CSCI 111 Final exam � of �6 6
16. (10 points) Given:
1 #include<iostream>
2
3 class Willow {
4 publi.
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxamrit47
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY GOOD WORK NICE FORMULA OR SOMETHING LIKE THAT, BUT ACTULLY HE CAN USE. THANK YOU.
Hartleys Function Code
Contains unread posts
Actions for Hartleys Function Code
Chad Hartley posted Nov 5, 2015 5:10 PM
Subscribe
This program will add an integer number and a decimal number up to 2 decimal places. I have included notes in the code to explain what each thing does. I hope I did this right. It compiles successfully.
PseudoCode
Start
Declare int O1; Stands for Output1
O1=sum; Sum is the functions name
Int sum()
Declare variables
Int num1;
Float num2;
Write “Enter a number.”
Scanf num1
Write”Enter a decimal number.”
Scanf num2
Return num1+num2
end
C Code
#include <stdio.h>
int sum();//prototype
int main()//calling program
{
//Declare a varaiable
int O1;
O1=sum();//main is calling sum one time.
//if I listed this twice it would run the function 'sum' twice.
// Example: if I add a new int (int O1, O2) and declare O2 to
//be O2=sum then the function would run twice.
}
int sum ()//function 'sum'
{
int num1;// Declare intergers/variables
float num2;
printf("Enter a number.\n");
scanf("%d",&num1);// Take first input and assign it to num1
printf("Enter a decimal number.\n");
scanf("%.2f",&num2);
//Can use the printf statement but when you are calling an integer you can use the return.
//printf("The sum of %d, %d, is %d", num1,num2,num1+num2);
return num1+num2;
}
ADD COMMENT HERE
Chaotic Function
Contains unread posts
Actions for Chaotic Function
Joshua Ray posted Nov 5, 2015 2:33 PM
Subscribe
float tmp
int i
function float chaos(float num)
{
for i < 20
num = 3.9*num*(1-num)
print num
}
main
print "Program description"
print "Request input btw 0 and 1"
tmp = input
chaos(tmp)
/*
* File: main.c
* Author: JaiEllRei
*
* Created on November 5, 2015, 2:04 PM
*/
#include <stdio.h>
#include <stdlib.h>
float chaos(float num);
int main(void)
{
float tmp;
printf("This program illustrates a choatic function. \n");
printf("Input a number between 0 and 1: ");
scanf("%f", &tmp);
chaos(tmp);
}
float chaos(float num)
{
for (int i=0; i<20; i++){
/*Chaotic Formula*/
num = 3.9 * num * (1-num);
printf("%.3f \n", num);
}
}
This program illustrates a choatic function.
Input a number between 0 and 1: .2
0.624
0.915
0.303
0.824
0.566
0.958
0.156
0.514
0.974
0.098
0.345
0.881
0.409
0.943
0.210
0.647
0.891
0.379
0.918
0.293
ADD COMMENT HERE
//MPH to KPH Conversion Function
Function KPHConv(value) as float
Set KPHConv = value*1.609344
End Function
Pseudocode for simple conversion program calling function
//Declare function
// MPH to KPH Conversion Function
Functio ...
C-Program Custom Library, Header File, and Implementation FilesI .pdfherminaherman
C-Program: Custom Library, Header File, and Implementation Files
I have this main.c file:
#include
#include
#include \"stats.h\"
int readGrades(char fileName[], float grades[]);
//Include this function prototype
void WelcomeToTheProgram();
int main()
{
///Declare Variables
char fileName[30];
float grades[1000]; //to store grades
int i, ArrayCount[10] = {0}; //to store histogram counts
/* Rewrite this line */
int num_grades; //for # of grades in file
///Call Intro Comment
WelcomeToTheProgram();
///Enter Filename
printf(\"\ \ \ Enter the data filename: \");
scanf(\"%s\", &fileName);
//Get # of grades in file
num_grades = readGrades(fileName, grades); //get # of grades in file
///Print Results
printf(\"There are %d grades read\ \", num_grades);
printf(\"Mean = %f\ \", mean(grades, num_grades));
printf(\"Variance = %f \ \", variance(grades, num_grades));
printf(\"Maximum = %f \ \", maximum(grades, num_grades));
printf(\"Minumum = %f \ \", minimum(grades, num_grades));
//Call histogram
histogram(grades, ArrayCount, num_grades);
//Print the histogram
printf(\"Grade Histogram\ \");
for (i = 0; i < 10; i++)
{
if (i != 9)
{
printf(\"\ %d %% - %d %%: %d \", i * 10, ((i + 1) * 10) - 1, ArrayCount[i]);
}
else
{
printf(\"\ 90 %% - 100 %%: %d\ \", ArrayCount[i]);
}
}
return 0;
}
///Reads all grades from the file to array
int readGrades(char fileName[], float grades[])
{
FILE *fpin = fopen(fileName, \"r\");
int num_scores = 0;
float value;
if (fpin == NULL)
{
printf(\"Cannot open the file\ \");
exit(0);
}
while ((fscanf(fpin, \"%f\", &value)) != EOF)
{
grades[num_scores] = value;
num_scores++;
}
return num_scores;
}
void WelcomeToTheProgram()
{
printf(\"***Welcome to the Program Which Involves a Custom Library***\");
printf(\"\ The program finds the minimum value, maximum value, mean,\");
printf(\"variance, and a histogram of the grades of data by calling\");
printf(\"implementation files min(), max(), mean(), variance(), and histogram().\ \");
}
But, the only thing that prints is
Enter the data file name: grades.txt
There are 400 grades read.
Then the program just stops, it does not print the min, max, mean, variance, or histogram. Any
ideas? Am I using the custom library wrong, the implementation files (for min, max, mean,
variance, and histogram) all check out with no warnings or errors.
Here is stats.h:
#ifndef STATS_H
#define STATS_H
float minimum(float *grades[], int Size); // NOTE: You need to complete the prototypes
float maximum(float *grades[], int Size);
float mean(float *grades[], int Size);
float variance(float *grades[], int Size);
void histogram(float *grades[], int *ArrayCount, int Size);
#endif // STATS_H
And here is the grades file:
Solution
//stats.h
#ifndef STATS_H
#define STATS_H
float minimum(float grades[], int Size); // NOTE: You need to complete the prototypes
float maximum(float grades[], int Size);
float mean(float grades[], int Size);
float variance(float grades[], int Size);
void histogram(float grades[], int ArrayCount[], int S.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
Do markets erode moral valuesDo markets erode moral values.pdfSANDEEPARIHANT
Do markets erode moral values?
Do markets erode moral values?
Solution
Marekets affects moral values as their are many examples we can consider, for instance many
people take stand against child labor, exploitations done to the worforce, cruelty against animals
for meat etc. Therefore its a long lasting, debatable topic. It also depends on what kind of market
it is individual, bilateral or multilateral.
Many researches and studies shows that when there is only one party then that particular party
get more guilt while in bilateral market the guilt is shared so it diminishes and in multilateral
market the percentage of eroding moral values are much higher than that in bilateral and
individual. In markets, many people ignore their own ethics, morals, rules etc.
Concept Simulation 25.2 illustrates the concepts pertinent to this pr.pdfSANDEEPARIHANT
Concept Simulation 25.2 illustrates the concepts pertinent to this problem. A 2.50-cm-high
object is situated 17.1 cm in front of a concave mirror that has a radius of curvature of 8.39 cm.
Calculate the location and the height of the image.
Solution
h = 2.50 cm, u = - 17.1 cm
f = R/2 = -8.39 / 2 = - 4.195 cm
1/v + 1/u = 1/f
v = [f * u] / [u - f] = [- 17.1 *- 4.195] / [- 17.1 + 4.195]
= - 5.56 cm [the left of itself ]
--------------------------------------------------
magnification = m = h\'/ h = - v/u
h\' / 2.50 = - [- 5.56 /- 17.1]
h\' = - 0.813 cm [image is inverted].
More Related Content
Similar to To write a program that implements the following C++ concepts 1. Dat.pdf
Program 1 (Practicing an example of function using call by referenc.pdfezhilvizhiyan
Program 1: (Practicing an example of function using call by reference)
Write a program that reads a set of information related to students in C++ class and prints them
in a table format. The information is stored in a file called data.txt. Each row of the file contains
student number, grade for assignment 1, grade for assignment 2, grade for assignment 3, and
grade for assignment 4. Your main program should read each row, pass the grades for the three
assignments to a function called ProcessRow to calculate the average of the grades, minimum of
the four assignments, and the maximum of the four assignments. The results (average,
maximum, and minimum) should be returned to the main program and the main program prints
them on the screen in a table format. For example, if the file includes
126534 7 8 10 7
321345 5 6 4 9
324341 8 3 8 5
your program should print
Std-Id A1 A2 A3 A4 Min Max Average
----------------------------------------------------------------------------------
126534 7 8 10 7 7 10 8
321345 5 6 4 9 4 9 6
324341 8 3 8 5 3 8 6
You must use call by reference to do the above question.
_________________________________________________________________
Program 2: (Practicing an example of function using call by value)
Repeat the above question using call by value. This means you need to have three different
functions: one to calculate the average, another to calculate the minimum, and the third one to
calculate the maximum. This is how to call these functions:
Max = CalculateMax(A1,A2,A3, A4);
Min = CalculateMin(A1,A2,A3, A4);
Average = CalculateAvg(A1,A2,A3, A4);
_________________________________________________________________
Program 3:
Write a program with several functions that performs the following tasks. :
Create a function that reads the following 5 float numbers from the file data.txt into array Called
Arr1.
12.0 15.0 29.3 25.0 93.2
Copy array Arr1 into array Arr2 in reverse order
Print array Arr1.
Print array Arr2.
Find the number of elements in array Arr1 that are >= 80 and <=100.
Find the number of the elements in array Arr1 in which their contents are divisible by 5
Find the index of the elements in array Arr1 in which their contents are divisible by 3.
Find mean (average) in array Arr1.
Find the maximum number in array Arr1.
Ask the user to input a key. Then search for the key in array Arr1 and inform the user about the
existence (true / false) of the key in array
Your program should include several functions.
A function for filling up the information from file into an array (part a should call this function)
A function that does the copying of one array into another in reverse order. Arrays must have the
same size (part b should call this function)
Printing any array with any size (part c and d should call this function)
finding and returning the number of elements between 80 and 100 in any array with any size
(part e calls this function)
finding and returning the number of elements in an array that are divisible by 5 (par.
[10] Write a Java application which first reads data from the phoneb.pdfarchiespink
[10] Write a Java application which first reads data from the phonebook file here:
660749054 Iwjint, Taib
638727163 Jroch, Ov
989981308 Vihoost, Yssoub
339223911 Vokoiv, Jishar
718489075 Owut, Praint
150942045 Bryk, Bloneip
862082436 Oich, Xoipjtt
703482042 Brjsh, Nuw
921326275 Bloop, Yss
472635412 Chivoon, Toupfaipf
into an ArrayList of phonebook entries. You may download the file and have your application
load it locally or have your application download the file directly. We’ll need to differentiate
between the name and phone number when sorting and retrieving data, so each entry should
consist of separate fields for the name and phone number (e.g., a class with two private String
variables would be considered good style here).
Solution
The PhoneDirectory class:
/* An object of type PhoneDirectory holds a list of names and associated
phone numbers. In this simple implementation, both the names and the
numbers are stored as strings. The names and numbers must be non-null
strings, but no attempt is made to ensure that the values make sense.
Comparison of names is in all cases case-insensitive. A given name
cannot occur more than once in the directory. The instance methods
throw IllegalArgumentExceptions when the rules are violated.
The instance methods load() and save() are provided for loading
the data for the directory from a stream and for saving the data
to a stream.*/
import java.io.*;
public class PhoneDirectory {
/* The data for the directory is stored in a pair of arrays. The phone
number associated with the name names[i] is numbers[i]. These
arrays will grow, as necessary, to accommodate as many entries as
are added to the directory. The variable count keeps track of
the number of entires in the directory. */
private String[] names = new String[1];
private String[] numbers = new String[1];
private int count = 0;
public boolean changed; // This variable is set to true whenever a change
// is made to the data in this directory. The value
// is false when the object is created. The only time
// that it is reset to false is if the load() method
// is used to load a phone directory from a stream.
// (Programs that use the directory can also set the
// value of changed if they want, since it\'s public.)
public void load(TextReader in) throws IOException {
// Clears any entries currently in the directory, and loads
// a new set of directory entries from the TextReader. The
// data must consist of the following: a line containing the
// number of entries in the directory; two lines for each
// entry, with the name on the first line and the associated
// number on the second line. Note that this method might
// throw an IllegalArgumentException if the data in the file
// is not valid -- for example if the same name occurs twice.
// Note that if an error does occur, then the original
// data in the directory remains.
int newCount = in.getlnInt();
String[] newNames = new String[newCount + 5];
String[] newNumbers = new String[newCount + 5];
for.
Programming For Big Data [ Submission DvcScheduleV2.cpp and StaticA.pdfssuser6254411
Programming For Big Data [ Submission: DvcScheduleV2.cpp and StaticArray.h and/or
DynamicArray.h ]
Assignment 5's runtime was too slow -- a couple of minutes or so. It's because of the duplicate-
checking, with over 4 billion compares.
Rewrite the duplicate-checking logic from Assignment 5, using a technique from "Techniques
For Big Data, Reading" to do fewer compares (check the term first then section number for the
duplicate check), and come up with the exact same results as Assignment 5.
You may use your StaticArray.h from Assignment 3 and/or your DynamicArray.h from
assignments 4, but you may not use any STL containers. Submit the H file(s) you use in your
solution, even if there are no changes since your previous work. Your project will be compiled
for grading using the default stack memory size of 1MB.
Since this version is supposed to be fast, there is no longer a need for a progress bar. Include one
if you wish (you may see the run time dramatically changed), or you may leave it out -- your
choice. But if you do have a progress bar, do remember to "flush"...
[Submission] - Submit the driver program (DvcScheduleV2.cpp) with the header files used
The code I wrote for previous assignment:
Main:
#include
#include
#include
#include
#include "DynamicArray.h"
using namespace std;
struct Class
{
string code;
int count;
};
int main()
{
DynamicArray sub;
DynamicArray sem;
DynamicArray sec;
int totalSubjects = 0;
int dup = 0;
int total = 0;
int counter = 0;
bool duplicate;
bool stored;
// For parsing input file
char* token;
char buf[1000];
const char* const tab = "\t";
// Open input file
ifstream fin;
fin.open("dvc-schedule.txt");
if (!fin.good())
{
cout << "I/O error. File can't be found!\n";
return 1; // Exit the program with an error code
}
// Read the input file
while (fin.good())
{
// Progress bar
if (counter % 1000 == 0)
{
cout << '.';
cout.flush();
}
duplicate = false;
stored = false;
string line;
getline(fin, line);
total++; // Total lines processed
strcpy(buf, line.c_str());
if (buf[0] == 0)
continue; // Skip blank lines
// Parse the line
const string term(token = strtok(buf, tab));
const string section(token = strtok(0, tab));
const string course((token = strtok(0, tab)) ? token : "");
const string instructor((token = strtok(0, tab)) ? token : "");
const string whenWhere((token = strtok(0, tab)) ? token : "");
if (course.find('-') == string::npos)
continue;
const string code(course.begin(), course.begin() + course.find('-'));
// Check for duplicates
for (int i = 0; i < counter; i++)
{
if (sem[i] == term && sec[i] == section)
{
dup++;
duplicate = true;
break;
}
}
if (duplicate == true)
continue;
sem[counter] = term;
sec[counter] = section;
counter++;
for (int i = 0; i < totalSubjects; i++)
{
if (sub[i].code == code)
{
sub[i].count++;
stored = true;
break;
}
}
if (stored == true)
continue;
Class y;
y.code = code;
y.count = 1;
sub[totalSubjects] = y;
totalSubjects++;
}
fin.close();
cout << endl;
for (int i = 0; i < totalSubjects; i++)
{
f.
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docxrafbolet0
Spring 2014 CSCI 111 Final exam � of �1 6
1. (2 points) Flip over this test. On the back of this test write your name in the upper, left-hand
corner.
2. (2 points) What are the four parts of the compiling process (just give me 4 words, not a
paragraph).
3. (4 points) Which of the four steps of the compiling process occurs only once, regardless of
the number of source files your application has?
4. (4 points) Write a line of code that causes the preprocessor to generate an error.
5. (4 points) Write a line of code that causes the compiler to generate an error.
6. (5 points) Describe how you could incorrectly compile the joust project to cause the linker to
generate an error.
7. (5 points) Given:
1 float* fp;
2 //...
3 float pi;
4 pi=*(314 + fp);
Rewrite line 4 using array subscript notation.
Spring 2014 CSCI 111 Final exam � of �2 6
8. (5 points) Given:
1 float arr[100];
2 for(int x=0; x<100; ++x)
3 arr[x]=100-x;
What does the following expression print out?
cout << *arr << endl;
9. (14 points) Given:
int a=0;
int b=6;
int x=0;
Circle each if-expression that evaluates to true:
A) if(b)
B) if(x)
C) if(a=b==6)
D) if(a=b==5)
E) if(a=b=5)
F) if(a=x=0)
G) if(a=x==0)
Spring 2014 CSCI 111 Final exam � of �3 6
10. (10 points) Given:
1 #include<iostream>
2 using namespace std;
3
4 int main()
5 {
6 int x;
7 cout << "Enter a number greater than 10" << endl;
8 while ( x < 10 )
9 {
10 cin >> x;
11 }
12 return 0;
13 }
This program compiles just fine, and sometimes it runs as expected. But sometimes when you
run it, it exits immediately after printing "Enter a number greater than 10". That is, the program
doesn't pause for you to enter a number. Why are you getting this inconsistent behavior?
11. (4 points) What is the output of the following:
int x=4;
int y=3;
A) cout << x / y << endl;
B) cout << x % y << endl;
C) cout << x << "%" << y << endl;
D) cout << "x" << '%' << 'y' << endl;
Spring 2014 CSCI 111 Final exam � of �4 6
12. (16 points) What is the type of the expression. That is, what is the kind of thing that each
expression evaluates to. For example:
3 + 4 integer
You may assume that the variable a has been declared as an integer.
A. a + 4
B. a = 4
C. 3.14 + 4.49
D. 3 + 3.14
E. 'a'
F. cout << a
G. new float[30]
H. new float
Spring 2014 CSCI 111 Final exam � of �5 6
13. (5 points) Write a for-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
14. (5 points) Write a while-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
15. (5 points) Write a do-while-loop that prints out the numbers between 1 and 100 that are
evenly divisible by three.
Spring 2014 CSCI 111 Final exam � of �6 6
16. (10 points) Given:
1 #include<iostream>
2
3 class Willow {
4 publi.
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxamrit47
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY GOOD WORK NICE FORMULA OR SOMETHING LIKE THAT, BUT ACTULLY HE CAN USE. THANK YOU.
Hartleys Function Code
Contains unread posts
Actions for Hartleys Function Code
Chad Hartley posted Nov 5, 2015 5:10 PM
Subscribe
This program will add an integer number and a decimal number up to 2 decimal places. I have included notes in the code to explain what each thing does. I hope I did this right. It compiles successfully.
PseudoCode
Start
Declare int O1; Stands for Output1
O1=sum; Sum is the functions name
Int sum()
Declare variables
Int num1;
Float num2;
Write “Enter a number.”
Scanf num1
Write”Enter a decimal number.”
Scanf num2
Return num1+num2
end
C Code
#include <stdio.h>
int sum();//prototype
int main()//calling program
{
//Declare a varaiable
int O1;
O1=sum();//main is calling sum one time.
//if I listed this twice it would run the function 'sum' twice.
// Example: if I add a new int (int O1, O2) and declare O2 to
//be O2=sum then the function would run twice.
}
int sum ()//function 'sum'
{
int num1;// Declare intergers/variables
float num2;
printf("Enter a number.\n");
scanf("%d",&num1);// Take first input and assign it to num1
printf("Enter a decimal number.\n");
scanf("%.2f",&num2);
//Can use the printf statement but when you are calling an integer you can use the return.
//printf("The sum of %d, %d, is %d", num1,num2,num1+num2);
return num1+num2;
}
ADD COMMENT HERE
Chaotic Function
Contains unread posts
Actions for Chaotic Function
Joshua Ray posted Nov 5, 2015 2:33 PM
Subscribe
float tmp
int i
function float chaos(float num)
{
for i < 20
num = 3.9*num*(1-num)
print num
}
main
print "Program description"
print "Request input btw 0 and 1"
tmp = input
chaos(tmp)
/*
* File: main.c
* Author: JaiEllRei
*
* Created on November 5, 2015, 2:04 PM
*/
#include <stdio.h>
#include <stdlib.h>
float chaos(float num);
int main(void)
{
float tmp;
printf("This program illustrates a choatic function. \n");
printf("Input a number between 0 and 1: ");
scanf("%f", &tmp);
chaos(tmp);
}
float chaos(float num)
{
for (int i=0; i<20; i++){
/*Chaotic Formula*/
num = 3.9 * num * (1-num);
printf("%.3f \n", num);
}
}
This program illustrates a choatic function.
Input a number between 0 and 1: .2
0.624
0.915
0.303
0.824
0.566
0.958
0.156
0.514
0.974
0.098
0.345
0.881
0.409
0.943
0.210
0.647
0.891
0.379
0.918
0.293
ADD COMMENT HERE
//MPH to KPH Conversion Function
Function KPHConv(value) as float
Set KPHConv = value*1.609344
End Function
Pseudocode for simple conversion program calling function
//Declare function
// MPH to KPH Conversion Function
Functio ...
C-Program Custom Library, Header File, and Implementation FilesI .pdfherminaherman
C-Program: Custom Library, Header File, and Implementation Files
I have this main.c file:
#include
#include
#include \"stats.h\"
int readGrades(char fileName[], float grades[]);
//Include this function prototype
void WelcomeToTheProgram();
int main()
{
///Declare Variables
char fileName[30];
float grades[1000]; //to store grades
int i, ArrayCount[10] = {0}; //to store histogram counts
/* Rewrite this line */
int num_grades; //for # of grades in file
///Call Intro Comment
WelcomeToTheProgram();
///Enter Filename
printf(\"\ \ \ Enter the data filename: \");
scanf(\"%s\", &fileName);
//Get # of grades in file
num_grades = readGrades(fileName, grades); //get # of grades in file
///Print Results
printf(\"There are %d grades read\ \", num_grades);
printf(\"Mean = %f\ \", mean(grades, num_grades));
printf(\"Variance = %f \ \", variance(grades, num_grades));
printf(\"Maximum = %f \ \", maximum(grades, num_grades));
printf(\"Minumum = %f \ \", minimum(grades, num_grades));
//Call histogram
histogram(grades, ArrayCount, num_grades);
//Print the histogram
printf(\"Grade Histogram\ \");
for (i = 0; i < 10; i++)
{
if (i != 9)
{
printf(\"\ %d %% - %d %%: %d \", i * 10, ((i + 1) * 10) - 1, ArrayCount[i]);
}
else
{
printf(\"\ 90 %% - 100 %%: %d\ \", ArrayCount[i]);
}
}
return 0;
}
///Reads all grades from the file to array
int readGrades(char fileName[], float grades[])
{
FILE *fpin = fopen(fileName, \"r\");
int num_scores = 0;
float value;
if (fpin == NULL)
{
printf(\"Cannot open the file\ \");
exit(0);
}
while ((fscanf(fpin, \"%f\", &value)) != EOF)
{
grades[num_scores] = value;
num_scores++;
}
return num_scores;
}
void WelcomeToTheProgram()
{
printf(\"***Welcome to the Program Which Involves a Custom Library***\");
printf(\"\ The program finds the minimum value, maximum value, mean,\");
printf(\"variance, and a histogram of the grades of data by calling\");
printf(\"implementation files min(), max(), mean(), variance(), and histogram().\ \");
}
But, the only thing that prints is
Enter the data file name: grades.txt
There are 400 grades read.
Then the program just stops, it does not print the min, max, mean, variance, or histogram. Any
ideas? Am I using the custom library wrong, the implementation files (for min, max, mean,
variance, and histogram) all check out with no warnings or errors.
Here is stats.h:
#ifndef STATS_H
#define STATS_H
float minimum(float *grades[], int Size); // NOTE: You need to complete the prototypes
float maximum(float *grades[], int Size);
float mean(float *grades[], int Size);
float variance(float *grades[], int Size);
void histogram(float *grades[], int *ArrayCount, int Size);
#endif // STATS_H
And here is the grades file:
Solution
//stats.h
#ifndef STATS_H
#define STATS_H
float minimum(float grades[], int Size); // NOTE: You need to complete the prototypes
float maximum(float grades[], int Size);
float mean(float grades[], int Size);
float variance(float grades[], int Size);
void histogram(float grades[], int ArrayCount[], int S.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
Similar to To write a program that implements the following C++ concepts 1. Dat.pdf (20)
Do markets erode moral valuesDo markets erode moral values.pdfSANDEEPARIHANT
Do markets erode moral values?
Do markets erode moral values?
Solution
Marekets affects moral values as their are many examples we can consider, for instance many
people take stand against child labor, exploitations done to the worforce, cruelty against animals
for meat etc. Therefore its a long lasting, debatable topic. It also depends on what kind of market
it is individual, bilateral or multilateral.
Many researches and studies shows that when there is only one party then that particular party
get more guilt while in bilateral market the guilt is shared so it diminishes and in multilateral
market the percentage of eroding moral values are much higher than that in bilateral and
individual. In markets, many people ignore their own ethics, morals, rules etc.
Concept Simulation 25.2 illustrates the concepts pertinent to this pr.pdfSANDEEPARIHANT
Concept Simulation 25.2 illustrates the concepts pertinent to this problem. A 2.50-cm-high
object is situated 17.1 cm in front of a concave mirror that has a radius of curvature of 8.39 cm.
Calculate the location and the height of the image.
Solution
h = 2.50 cm, u = - 17.1 cm
f = R/2 = -8.39 / 2 = - 4.195 cm
1/v + 1/u = 1/f
v = [f * u] / [u - f] = [- 17.1 *- 4.195] / [- 17.1 + 4.195]
= - 5.56 cm [the left of itself ]
--------------------------------------------------
magnification = m = h\'/ h = - v/u
h\' / 2.50 = - [- 5.56 /- 17.1]
h\' = - 0.813 cm [image is inverted].
Based on what you have learned about the aquatic environment and the .pdfSANDEEPARIHANT
Based on what you have learned about the aquatic environment and the life needs and
adaptations of planktonic and benthic organisms found in it, What changes do you expect in
abiotic conditions in or just above the sediments to those in the water column at the same site?
How might the species of organisms and their abundance differ between those habitats, and
might any differences be related to differences in abiotic conditions? What differences might
you expect in the water column at a deep site versus a shallow site?
Solution
The variations in the abiotic components in a n aquatic ecosytem between the sedimentary zone
and the water column basically lies in the difference in the functionality of the components of the
ecosystem. These variations result due to the activity of the biotic components also.
The sedimentation zones are analogous to the to soil of the terrestrial ecosystem and tthey are the
sources of substrate nutrients.aquatic sediments are derived from and comprise of natural ,
physical,chemical and biologicaal components related to their water sheds.
fast moving waters have coarse grained sediments while the quiscent or the still waters contain
fine grained sediments. Organic matter are derived from the decomposing of the plant and the
animal tissue and hence is rich in nutrients like the phosphates and nitrates . It is the zone where
maximum decompositional activity takes place.. The dissolved chemicals reflect the nature of the
organic and inorganic matter of the sediments.
While the column of the water at the same site may not be rich in the sediments but may have
floating sediments and the nutrients like the nitrates and phosphates may be at a lower
concentration when compared to the sedimental zone due to lack of the decomposing matter.
2. DIversity of organisms and their abundance :
The organisms that occur in the water column and the sedimental zone varies.This is mainly
because of the differences in their habitat and nutritional requirements.
The sedimental zone is rich in decomposing bacteria and other detritus organisms while the
water column may support planktons both phyto and zoo plankton. free floating algae, the
plankton diversity also varies according to their light requirement , oxygen requirement etc..
A) If A, then B. If B, then C. Therefore, if A, then C There are 350.pdfSANDEEPARIHANT
A) If A, then B. If B, then C. Therefore, if A, then C There are 350 million Americans. Only
50,000 Americans have ever been to Siberia. Sarah is a randomly selected American. Therefore,
Sarah has never been to Siberia. Can you expalin your answer. 1. Deductive, valid 2. Inductive,
reasonable 3. Inductive, unreasonable
Solution.
Describe the therapeutic goal in treating acid-peptic disease.So.pdfSANDEEPARIHANT
Describe the therapeutic goal in treating acid-peptic disease.
Solution
The therapeutic goal in treating acid-peptic disease include the following:
Relief from the symptoms such as pain that occurs in between meals in the middle or upper
portion of stomach , bloating, heart burn anf nausea.
Healing of the ulcer that has affected the mucosal part of esophagus, stomach and duodenum.
Prevention of reoccurrence of the ulcer.
Synthesis of drugs such as histamine H2-receptor antagonists.
Synthesis of drugs such as proton-pump inhibitors (PPIs) that bind to H+,K+-ATPase
irreversibly thereby blocking the final step of gastric acid secretion.
Synthesis of antibiotics against H. pylori which can cause peptic ulcers..
Compare structure and culture of two or more firms. Which would you .pdfSANDEEPARIHANT
Compare structure and culture of two or more firms. Which would you prefer to work for?
no spam or plagiarism complete answer.... ..
Solution
S.No.
Particulars
Firm A (MNC in FMCG industry)
Firm B ( Domestic Manufacturer in FMCG industry)
1
Organization structure
Line Structure with functional Breakup and Project Structure. Both structure are interwoven with
each other. Here, organizational objective is at prime focus. More attention is given on team
work.
Line structure with functional breakup. People follow their regular job and functional interest is
given due consideration.
2
Flow of Information
Top-Down, Bottom-up and parallel
Top-Down
3
Culture
Strong organizational Culture. It binds people through shared assumption and knowledge. Core
is developed through Strong values.
Weak Organizational Culture. It is less binding in nature and people rely more on rule books.
4
Reliance on Written Rules
Lesser Reliance
Strong Reliance
5
Technology
Excessive use of Technology
Lesser use of Technology
6
Change management approach
Emergent change approach
Planned change approach
I would like to work for MNC in FMCG industry because it gives me delegation of authority and
encourages me to work as a team that is the necessary ground of any successful initiative.
Note:
Actual Name of the company cannot be disclosed due to violation of the right to use the name /
brand and related issues.
S.No.
Particulars
Firm A (MNC in FMCG industry)
Firm B ( Domestic Manufacturer in FMCG industry)
1
Organization structure
Line Structure with functional Breakup and Project Structure. Both structure are interwoven
with each other. Here, organizational objective is at prime focus. More attention is given on
team work.
Line structure with functional breakup. People follow their regular job and functional interest is
given due consideration.
2
Flow of Information
Top-Down, Bottom-up and parallel
Top-Down
3
Culture
Strong organizational Culture. It binds people through shared assumption and knowledge. Core
is developed through Strong values.
Weak Organizational Culture. It is less binding in nature and people rely more on rule books.
4
Reliance on Written Rules
Lesser Reliance
Strong Reliance
5
Technology
Excessive use of Technology
Lesser use of Technology
6
Change management approach
Emergent change approach
Planned change approach.
WRITE A program that displays the values in the list numbers in desc.pdfSANDEEPARIHANT
WRITE A program that displays the values in the list numbers in descending order sorted by the
sum of their digits that odd numbers . sorted by sum of odd digits: [1169, 290, 865, 1243, 1208]
Solution
python program:
list1=[];
list2=[];
print \"Enter number of variables:\";
size=input();
for i in range(size):
print \"Enter variable\",i+1;
v=input();
list1.append(v);
for number in list1:
n=number;
m=0;
while n>0:
r=n%10;
if r%2==1:
m=m+r;
n=n/10;
list2.append(m);
print \"list before ordering\";
print list1;
for num1 in range(len(list2)):
for num2 in range(num1+1,len(list2)):
if list2[num1].
What is an oligopotent stem cell and what is an exampleSolution.pdfSANDEEPARIHANT
What is an oligopotent stem cell and what is an example?
Solution
Oligopotent cell lines have the ability to transform in to quite a limited number of several other
types of cells,an example of which is a myeloid cells ,B cells,T cells,plasma cells or the cells
comprising the lymphoid system.An example of Oligopotent cells are myeloid cell can
differentiate in to any of the blood stem cells found in the lymphatic system.
What are 4 different types of CVI systemsSolutionThe four typ.pdfSANDEEPARIHANT
What are 4 different types of CVI systems?
Solution
The four type of CVI i.e, Chemical VapourInfiltration system are;
1. Carbon-Carbon with Kerosene/ Methane as common precursor.
2. Carbon-Silicon Carbide with CH3SiCl3H2 as common precursor.
3. SiliconCarbide-Silicon Carbide with CH3SiCl3H2 as common precursor.
4. Alumina-Alumina with AlCl3CO2H2 as common precursor.
Why is RNA more prone than DNA to forming secondary structures.pdfSANDEEPARIHANT
Why is RNA more prone than DNA to forming secondary structures?
Solution
DNA has limited catalytic ability because it lacks functional groups that can participate in
catalysis and has a regular structure that is not conducive to forming shapes required for
catalysis.RNA molecules can catalyze some reactions because they have exposed hydroxyl
functional groups and can fold into shapes that then can function in catalysis.The increased
stability of RNA duplexes allows for highly diverse secondary and tertiary structures..
What are the advantages and disadvantage of using the metric system o.pdfSANDEEPARIHANT
What are the advantages and disadvantage of using the metric system of measurements?
Solution
Answer:
Advantages:
(1) Its based on decimal system instead of fractions which makes it a simpler system.
(2) Has one unit for each quantity which eliminates the need of conversion.
(3) It is universally accepted system.
Disadvantages:
(1) Difficult to make one acquainted with the metric system who is already using imperial units.
(2) Difficult to use with fractions..
Which of the following model organisms would be the best choice if y.pdfSANDEEPARIHANT
Which of the following model organisms would be the best choice if you wanted to to and in
vivo study of early animal cellular division?
Xenopus
Mouse
E. coli
Arabidopsis
Drosophila
Xenopus
Mouse
E. coli
Arabidopsis
Drosophila
Solution
Model organism is an organism selected for intensive scientific study based on features that
make it easy to work with in the hope that findings will apply to other species .
The correct answer is Arabidopsis. The aerial parts of the plants are generated by group of
dividing cells called shoot apical meristem. To analyse, cell behaviour in these structures, we
developed a technique to visualise living shoot apical meristems using confocal microscope. This
method combined with fluorescent marker lines and vital stains, allows us to follow dynamics of
cell proliferation and division..
Write a C program that reads the words the user types at the command.pdfSANDEEPARIHANT
Write a C program that reads the words the user types at the command prompt (using the \'int
argc, char * argv[] and store each unique letter in a Binary Search Tree. When a duplicate is
encountered do not store the letter again and instead keep track of the count in the tree. Once the
Binary Search tree has been created print out the tree both inorder and reverse order. Also print
the highest and lowest alphabetically letter in the tree if any.
Solution
# include
# include
# include
typedef struct BST {
int data;
struct BST *lchild, *rchild;
} node;
void insert(node *, node *);
void preorder(node *);
findMinimum(struct node* root)
findMaximum(struct node* root)
void reverseLevelOrder(struct node* root)
void main(int argc,char argv) {
char argv = \'N\';
int key;
node *new_node, *root, *tmp, *parent;
node *get_node();
root = NULL;
clrscr();
printf(\"\ Program For Binary Search Tree \");
do {
printf(\"\ 1.Create\");
printf(\"\ 2.Search\");
printf(\"\ 3.Recursive Traversals\");
printf(\"\ 4.Exit\");
printf(\"\ Enter your choice :\");
scanf(\"%d\", &argc);
switch (argc) {
case 1:
do {
new_node = get_node();
printf(\"\ Enter The Element \");
scanf(\"%d\", &new_node->data);
if (root == NULL) /* Tree is not Created */
root = new_node;
else
insert(root, new_node);
printf(\"\ Want To enter More Elements?(y/n)\");
argv= getch();
} while (argv == \'y\');
break;
case 2:
if (root == NULL)
printf(\"Tree Is Not Created\");
else {
printf(\"\ The Preorder display : \");
preorder(root);
}
break;
}
} while (argv != 4);
}
/*
Get new Node
*/
node *get_node() {
node *temp;
temp = (node *) malloc(sizeof(node));
temp->lchild = NULL;
temp->rchild = NULL;
return temp;
}
/*
This function is for creating a binary search tree
*/
void insert(node *root, node *new_node) {
if (new_node->data < root->data) {
if (root->lchild == NULL)
root->lchild = new_node;
return newNode(key);
else
insert(root->lchild, new_node);
}
if (new_node->data > root->data) {
if (root->rchild == NULL)
root->rchild = new_node;
return newNode(key);
else
insert(root->rchild, new_node);
}
}
if (key == node->key)
{
(node->count)++;
return node;
}
/*
This function displays the tree in preorder fashion
*/
void preorder(node *temp) {
if (temp != NULL) {
printf(\"%d\", temp->data);
preorder(temp->lchild);
preorder(temp->rchild);
}
}
// Returns maximum value in a given Binary Tree
int findMaximum(struct node* root)
{
// Base case
if (root == NULL)
return INT_MAXIMUM;
// Return maximum of 3 values:
// 1) Root\'s data 2) Max in Left Subtree
// 3) Max in right subtree
int res = root->data;
int lres = findMaximum (root->lchild);
int rres = findMaximum (root->rchild);
if (lres > res)
res = lres;
if (rres > res)
res = rres;
return res;
}
// Returns minimum value in a given Binary Tree
int findMinimum(struct node* root)
{
// Base case
if (root == NULL)
return INT_MINIMUM;
// Return minimum of 3 values:
// 1) Root\'s data 2) Max in Left Subtree
// 3) Max in right subtree
int res = root->data;
int lres = findMinimum(r.
What happens to jointly held stock between two siblings when one .pdfSANDEEPARIHANT
What happens to jointly held stock between two siblings when one dies. How should this
property be reported
What happens to jointly held stock between two siblings when one dies. How should this
property be reported
Solution
All of the stocked are transferred in the name of survived sibling , after verification of death
certificate.
The HER incentive programs incentive payments to eligible hospitals, .pdfSANDEEPARIHANT
The HER incentive programs incentive payments to eligible hospitals, and CAHs: to adopt,
implement, upgrade, or demonstrate meaningful use of CEHRT to donate technology to
understand and rural areas to participate in clinical trials Whish of the following entities is
charged with managing the federal HER incentive programs? CMS ONCHIT congress Which
of the following organizations is the principal federal entity charged with coordination of
nationwide efforts to implement and use the most advanced HIT and the electronic of health
information? CMD AHRQ ONCHIT The law that ended preexisting condition exclusions for
children (health plans can no longer limit or deny benefits to children younger than 19 because
of a preexisting condition)is: HIPAA HITECH PPACA The CLIA of 1988: eliminates the
exception under the HIPAA privacy rule to an individual\'s right to access his or her protected
health information when it id held by a CLIA-certified or CLIA-exempt laboratory. Created the
exception under the security rule to an individual\'s right to access his or her protected health
information when it id held by a CLIA-certified or CLIA-exempt laboratory. determined that
patients may not access their protected health information when it is held by a CLIA-certified or
CLIA-exempt laboratory. Project HealthDesign was a groundbreaking national program of
Robert wood Johnson foundation\'s pioneer portfolio, designed to spark innovation in: Personal
health technology EHR robotics
Solution
8) CMS
7) a
9)c. ONCHIT
10)c. PPAC
11)a.e eliminated the exception
12)a. Personal health technology.
The comet Shoemaker-Levy 9 broke up into a number of pieces called t.pdfSANDEEPARIHANT
The comet Shoemaker-Levy 9 broke up into a number of pieces called the ‘string of pearls’ as it
approached close to Jupiter. The breakup happened because of the
__________________________________ of Jupiter. (Fill in the blank)
Solution
Differential pull of the planet\'s enormous gravitational force on the near and far sides of the
comet fragmented it into 21 or more large pieces and an enormous amount of smaller debris.
The existence of universal values is still a matter of debate. But e.pdfSANDEEPARIHANT
The existence of universal values is still a matter of debate. But even in situations where it is no
clear common ground, Donaldson’s ethical algorithm can help by allowing one to consider if the
economic development levels are different between two countries, whether or not the act would
be considered moral if the two countries have equivalent economies. TRUE or FALSE
Solution
TRUE.
The c program will implement the Caesar Cipher. Your program shou.pdfSANDEEPARIHANT
\" The c program will implement the Caesar Cipher. Your program should take a command line
argument, which will be the offset, while the input through standard in will be the part that will
be rotated(encrypted/decrypted). To simplify this assignment you will only need to rotate
characters that are alpha characters (letters). No other characters should be rotated. You can also
assume that the input will only be a single line long. Your script will take a single command line
argument, which will be the rotation argument to the Caesar c program you wrote above. Your
script should then call the \"Program2_2.\" you wrote each of the .enc files. Your script should
output a .dec file for each .enc file that exists. \"
Solution
#include
#include
#define MAXSIZE 1024
void encrypt(char*);
void decrypt(char*);
int menu();
int
main(void)
{
char c,
choice[2],
s[MAXSIZE];
while(1)
{
menu();
gets(choice);
if((choice[0]==\'e\')||(choice[0]==\'E\'))
{
puts(\"Input text to encrypt->\");
gets(s);
encrypt(s);
}
else if((choice[0]==\'d\')||(choice[0]==\'D\'))
{
puts(\"Input text to decrypt->\");
gets(s);
decrypt(s);
}
else
break;
}
return 0;
}
void encrypt(char*str)
{
int n=0;
char *p=str,
q[MAXSIZE];
while(*p)
{
if(islower(*p))
{
if((*p>=\'a\')&&(*p<\'x\'))
q[n]=toupper(*p + (char)3);
else if(*p==\'x\')
q[n]=\'A\';
else if(*p==\'y\')
q[n]=\'B\';
else
q[n]=\'C\';
}
else
{
q[n]=*p;
}
n++; p++;
}
q[n++]=\'\\0\';
puts(q);
}
void decrypt(char*str)
{
int n=0;
char *p=str,
q[MAXSIZE];
while(*p)
{
if(isupper(*p))
{
if((*p>=\'D\')&&(*p<=\'Z\'))
q[n]=tolower(*p - (char)3);
else if(*p==\'A\')
q[n]=\'x\';
else if(*p==\'B\')
q[n]=\'y\';
else
q[n]=\'z\';
}
else
{
q[n]=*p;
}
n++; p++;
}
q[n++]=\'\\0\';
puts(q);
}
int menu()
{
puts(\"To encrypt, input e or E\ \");
puts(\"To decrypt, input d or D\ \");
puts(\"To exit, input any other letter\ \");
puts(\"Your choice:->\ \");
return 0;
}.
Amino acids are acids because they contain which functional group S.pdfSANDEEPARIHANT
Amino acids are acids because they contain which functional group? Select one: a. carboxyl b.
sulfhydryl c. carbonyl d. methyl e. amino
Solution
Amino acids possess acidic nature due to the presence of Carboxylic group I.e. CooH group.
The CooH group has the capability to donate H+ or proton, so it act as an acid.
According to Branstead lowry theory, compound that release H+ ion is called Acid. And due to
the presence of CooH group, Amino acid act like acid.
Suppose that theta is an acute angle of a right triangle and tan (the.pdfSANDEEPARIHANT
Suppose that theta is an acute angle of a right triangle and tan (theta) = 4 Squareroot 2/7. Find
sin(theta) and cos(theta).
Solution
given tan =(42)/7
tan =oppositeside/adjacent side =(42)/7
oppositeside=42 ,adjacent side=7
hypotenuse2=opposite side2+adjacent side2
hypotenuse2=(42)2+72
hypotenuse2=81
hypotenuse=9
sin =oppositeside/hypotenuse=(42)/9
cos =adjacentside/hypotenuse=7/9.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
The Roman Empire A Historical Colossus.pdfkaushalkr1407
The Roman Empire, a vast and enduring power, stands as one of history's most remarkable civilizations, leaving an indelible imprint on the world. It emerged from the Roman Republic, transitioning into an imperial powerhouse under the leadership of Augustus Caesar in 27 BCE. This transformation marked the beginning of an era defined by unprecedented territorial expansion, architectural marvels, and profound cultural influence.
The empire's roots lie in the city of Rome, founded, according to legend, by Romulus in 753 BCE. Over centuries, Rome evolved from a small settlement to a formidable republic, characterized by a complex political system with elected officials and checks on power. However, internal strife, class conflicts, and military ambitions paved the way for the end of the Republic. Julius Caesar’s dictatorship and subsequent assassination in 44 BCE created a power vacuum, leading to a civil war. Octavian, later Augustus, emerged victorious, heralding the Roman Empire’s birth.
Under Augustus, the empire experienced the Pax Romana, a 200-year period of relative peace and stability. Augustus reformed the military, established efficient administrative systems, and initiated grand construction projects. The empire's borders expanded, encompassing territories from Britain to Egypt and from Spain to the Euphrates. Roman legions, renowned for their discipline and engineering prowess, secured and maintained these vast territories, building roads, fortifications, and cities that facilitated control and integration.
The Roman Empire’s society was hierarchical, with a rigid class system. At the top were the patricians, wealthy elites who held significant political power. Below them were the plebeians, free citizens with limited political influence, and the vast numbers of slaves who formed the backbone of the economy. The family unit was central, governed by the paterfamilias, the male head who held absolute authority.
Culturally, the Romans were eclectic, absorbing and adapting elements from the civilizations they encountered, particularly the Greeks. Roman art, literature, and philosophy reflected this synthesis, creating a rich cultural tapestry. Latin, the Roman language, became the lingua franca of the Western world, influencing numerous modern languages.
Roman architecture and engineering achievements were monumental. They perfected the arch, vault, and dome, constructing enduring structures like the Colosseum, Pantheon, and aqueducts. These engineering marvels not only showcased Roman ingenuity but also served practical purposes, from public entertainment to water supply.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
To write a program that implements the following C++ concepts 1. Dat.pdf
1. To write a program that implements the following C++ concepts 1. Data Encapsulation 2.
Instantiate classes 3. Composition Class 4. Aggregation Class 5. Dynamic Memory 6. File
Stream Make a program that reads a file and can generate reports. Each file will have phone calls
records (see section 4). The program will process the data gathering all minutes and total amount
for each report. The program should have a menu (see section 1): 1. New Report – this option
will ask a file name (TE??????.tel). This option will instantiate an object of Report class, loading
the whole file into memory. 2. Delete a report – this option will display all reports available in
memory and ask which one you would like to delete. 3. Display a report – this option will
display all reports available in memory and ask you which one you would like to generate a
report. 4. Exit – Program ends. For option 1, you do not know how many reports are, meaning
that you will create dynamically the reports. For long distance calls the formula will be (minutes
call x $1.50). For local phone calls the formula will be (minutes call x $0.25)
--------------------------------------------------------------------------------------------------------------------
----------------------------
//Main.cpp
*#define between(x,y,z) ((x>=y && x<=z)? true:false)
#include
#include
#include
#include "Data.h"
#include "Report.h"
#include "Menu.h"
using namespace std;
//uses class Report to create reports
//uses class Menu to display a menu to choose
int main() {
int idx = 0;
int count = idx;
Menu menu("Reports");
Data temp;
string fileName;
Report* phoneCompany;
Report* newReport(Report*, int&);
Report* deleteReport(Report*, int&, int);
int displayReport(Report*, int);
2. bool fileNameExists(string);
menu.addMenuItem("New Report");
menu.addMenuItem("Delete a Report");
menu.addMenuItem("Display a Report");
ofstream openFile;
phoneCompany = NULL;
phoneCompany = new Report[count];
do {
cout << menu;
cin >> menu;
switch (menu.getChoice()) {
case '1':
cout << " tEnter report name (TE??????): ";
cin >> fileName;
openFile.open(fileName + ".tel");
if (openFile.good()) {
cout << " tReport succesfully created. ";
phoneCompany[count].setFileName(fileName);
count++;
}
else {
cout << " terror: Could not create report. ";
}
break;
case '2':
if (count != 0) {
do {
system("cls");
cout << " tDelete a Report: ";
idx = displayReport(phoneCompany, count);
if (between(idx, 0, count - 1)) {
phoneCompany = deleteReport(phoneCompany, count, idx);
idx = 0;
}
else
cout << " terror: Report could not be deleted. ";
3. } while (idx != count);
}
else {
cout << " tNo reports to delete. ";
system("pause");
}
break;
case '3':
if (count != 0) {
do {
system("cls");
cout << "Display a Report: ";
idx = displayReport(phoneCompany, count);
system("cls");
cout << " t" << phoneCompany[idx].getFileName();
cout << " tWould you like to edit the report?";
cout << " t1. Yes";
cout << " t2. No";
char ch;
cin >> ch;
do {
switch (ch) {
case '1':
cin >> temp;
phoneCompany[idx].setRecord(temp);
case '2':
cout << phoneCompany[idx];
default:
cin.ignore();
break;
}
} while (ch != '2');
} while (idx != count);
}
else {
cout << " tNo reports to display. ";
4. system("pause");
}
break;
case '4':
cout << "tThank you for using this Report System. ";
break;
default:
cin.ignore();
break;
}
} while (menu.getChoice() != 4);
delete[]phoneCompany;
system("pause");
}
Report* newReport(Report* report, int& total) {
if (total == 0) {
report = new Report[1];
}
else {
Report* temp = new Report[total];
for (int i = 0; i < total; i++) {
temp[i] = report[i];
}
delete[]report;
report = new Report[total + 1];
for (int i = 0; i < total; i++) {
report[i] = temp[i];
}
delete[]temp;
}
total++;
return report;
}
Report* deleteReport(Report* report, int& total, int idx) {
Report* temp = new Report[total - 1];
string fileName = report[idx].getFileName();
5. for (int i = 0; i < total; i++) {
temp[i] = report[i];
}
delete[]report;
total--;
report = new Report[total];
for (int i = 0; i < total; i++) {
report[i] = temp[i];
}
delete[]temp;
cout << "Report " << fileName << " has been deleted. ";
if (total == 0)
report = NULL;
return report;
}
int displayReports(Report* report, int total) {
int choice;
int i;
for (i = 0; i < total; i++) {
cout << "t" << i + 1 << ". " << report[i].getFileName() << endl;
}
cout << "t" << i + 1 << ". Return ";
cout << "Choose: ";
cin >> choice;
return (choice - 1);
}*/
// Report.h
#pragma once
#include
#include
#include "Data.h"
using namespace std;
//uses class Data to create a dynamic array containing client phone information
class Report {
friend ostream&operator<<(ostream&, const Report&);
private:
6. Data* records;
string fileName;
int totalRecords;
float totalMinutes;
float totalAmount;
public:
Report();
Report(const Data&, string);
Report(const Report&);
~Report();
void setRecord(const Data&);
void setFileName(string);
void setTotalMinutes(float);
void setTotalAmount(int);
Data getRecord(int)const;
string getFileName()const;
int getTotalRecords()const;
float getTotalMinutes()const;
float getTotalAmount()const;
};
//Report.cpp
#include
#include
#include "Data.h"
#include "Report.h"
using namespace std;
ostream&operator<<(ostream& output, const Report& aReport) {
for (int i = 0; i < aReport.getTotalRecords(); i++) {
output << "Report number is: " << aReport.getRecord(i) << endl;
}
return output;
}
Report::Report() {
totalRecords = 0;
fileName = "";
}
7. Report::Report(const Data& aData, string name) {
records[0] = aData;
fileName = name;
totalRecords = 1;
}
Report::Report(const Report& aReport) {
setRecord(*aReport.records);
setFileName(aReport.fileName);
setTotalMinutes(aReport.totalMinutes);
setTotalAmount(aReport.totalAmount);
}
Report::~Report() {}
void Report::setRecord(const Data& aData) {
int idx = totalRecords;
if (totalRecords == 0) {
records = new Data[1];
}
else {
Data* temp = new Data[totalRecords];
for (int i = 0; i < totalRecords; i++) {
temp[i] = records[i];
}
delete[]records;
records = new Data[totalRecords + 1];
for (int i = 0; i < totalRecords; i++) {
records[i] = temp[i];
}
delete[]temp;
}
records[idx] = aData;
totalRecords++;
}
void Report::setFileName(string name) {
fileName = name;
}
void Report::setTotalMinutes(float minutes) {
8. totalMinutes = minutes;
}
void Report::setTotalAmount(int idx) {
if (records[idx].getLongDistance() == 1) {
totalAmount = getTotalMinutes()*1.25;
}
else {
totalAmount = getTotalMinutes()*0.25;
}
}
Data Report::getRecord(int idx)const {
return records[idx];
}
string Report::getFileName()const {
return fileName;
}
int Report::getTotalRecords()const {
return totalRecords;
}
float Report::getTotalMinutes()const {
return totalMinutes;
}
float Report::getTotalAmount()const {
return totalAmount;
}
// Person.h
#pragma once
#include
using namespace std;
//stores a Persons' information
class Person {
friend ostream&operator<<(ostream&, const Person&);
friend istream&operator>>(istream&, Person&);
private:
string firstName;
string middleName;
23. longDistance = true;
else
longDistance = false;
timeCallBegin = line.substr(160, 165);
timeCallEnd = line.substr(166, 171);
callNoFrom = line.substr(172, 181);
callNoTo = line.substr(182, 191);
blank = line.substr(192, 250);
record.setClient(Person(firstName, middleName, lastName, maidenName));
record.setCallDate(callDate);
record.setLongDistance(longDistance);
record.setTimeCallBegin(timeCallBegin);
record.setTimeCallEnd(timeCallEnd);
record.setCallNoFrom(callNoFrom);
record.setCallNoTo(callNoTo);
return record;
}
=====================================================================
======
This is what I have so far
I need the program to give me the following output but it giving me error in the Main.cpp and
such, any help would be appreaciated. Section 5 Output cmd.exe eport Date: 01/26/2015 eport
from: TE20150126.tel ast Name First Name Call Date Long From To Mins odriguez Soto Carlos
M 01/26/2015N 787-399-2234 787-234-2345 26 6.50 1/19/2015 N 787-234-5643 787-345-1234
38 9.50 2/23/2014787-356-2345 305-456-234567 100.50 Felix G David P erez Roman Grand
Total: 131 116.50 C:UsersCarlosDocuments
Solution
Sum of Natural Numbers Using while Loop