Help me creat java script ! Problem A: Looking through data (20 points) Download
ID: 3577432 • Letter: H
Question
Help me creat java script !
Problem A: Looking through data (20 points) Download peopleData.txt and look through it (you can also rename it peopleData.csv to open in excel or some spreadsheet app). Write a program that reads this file then finds and displays on the username and password, if that line has one in the format “[username] : [password]”. This should be repeated until the end of the file (without displaying the last one twice!).
You cannot assume the username will always be in the same place (or that it exists for a person at all). You may assume that if there is a username, then there will be a password (but again, you should not assume where it is located in the line). You do not need to check and see if the file properly exists here.
Example 1 (generated from peopleData.txt):
Herch1955 : ahg7aa9Kei
Ardsomal : aiCoh6Chi
Felich : eiHee3ie
Therstion : AeTai9ien3ie
Wittiptacked : ha8Thufah
Hisaim : Oocaing8
Test your program using not only the example data above, but other cases as well. And revise your program until you are sure it is correct.
peopleData.txt link at below.
http://www-users.cselabs.umn.edu/classes/Fall-2016/csci1103/assignments/peopleData.txt and
peopleData's content are below.
Explanation / Answer
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
using namespace std;
double bisection(double, double, double, int);
int main()
//
// division algorithmic program
//
//
void printpars(int=0, double=0, double=0, double=0, double=0); // ex gratia
double bisection(double a, double b, double tol, int n0)
three Set p = a + (b - a)/2 . (Compute pi)
double p = a + (b-a)/2.;
// Step three.opt OUTPUT i a b p f(p) (optional)
printpars(i, a, b, p, f(p)); // optional: parameters
// Step four If abs(f(p)) < one.E-19 or (b - a ) /2 < tol then
if(fabs(f(p)) < one.E-19 || (b-a)/2. < tol)
come back p; // (Procedure completed with success.)
// Step five Set i = i + one
++i;
// Step half-dozen If f(a)f(p) > zero then set a = p (compute ai, bi )
// else set b = p
if(f(a)*f(p) > 0)
a = p;
else
b = p;
}
// Step seven OUTPUT (“Method unsuccessful once N0 iteractions, N0 = ‘, N0 );
// (procedure completed unsuccessfully.)
// STOP
cout << "Method unsuccessful once N0 iteractions, N0 = "<<n0<<" ";
exit(2);
}
// Extra: print parameters
void printpars(int i, double a, double b, double p, double fp)
initial = true;
if (first)providing 1st time
1st = false;
cout << setw(3) << "i ";
cout << setw(9) << "a ";
cout << setw(9) << "b ";
cout << setw(9) << "p ";
cout << setw(9) << "fp ";
cout << fastened << showpoint << setprecision(5);
return;
}
cout << setw(3) << i << " ";
cout << setw(9) << a << " ";
cout << setw(9) << b << " ";
cout << setw(9) << p << " ";
cout << setw(9) << fp<< " ";
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.