using python3
Write a Python program that lets a user search through the 'data.txt' file for a given first name, last name, or email address, and print all the matches/results.
Test your program.
In: Computer Science
Exercise 18: Running Ex. 16 You will write exercise 16 into a program and make it run. Note that there are two parts, 16A and 16B. Type 16A into a program called Exercise16A and type 16B into a program called Exercise16B. Be sure label each section using comments. You may notice that additional code needs to be written for the program to run. For example, Section I assumed that an array was already declared and initialized. Here, you will have to declare and initialize an array with random values to test it.
Section A. Declare and initialize an array firstNames containing the following names: Jane, Jim, Beth, Mary, Sara, and Bob. Remember to choose the correct data type for the array elements.
Section B. Using a FOR loop, output the elements of the array firstNames so that they are displayed on the same line and separated by a space. Use .length to get the length of the array.
In: Computer Science
2. If A is regular, and A = A, then B must be not regular. True or False
3. Given three languages A, B, C where . If both A and B are regular, then C must be regular. True or False
Automata and Computation
In: Computer Science
1. You have landed your dream job working for Steve Evert. Unfortunately, Steve doesn't know anything about making solid business decisions. Your first assignment is to help educate Steve on the difference between transactional and analytical information and how he can use a digital dashboard to consolidate data and drill down into the details of data to help run his business.
2. Steve would also like you to create a document highlighting the five different types of artificial intelligence systems and how each system might help support making business decisions.
3. Why would the DoD use an event like the DARPA Grand Challenge or DARPA Robotic Challenge to further technological innovation?
4. Describe how autonomous vehicles and robots could be used by organizations around the world to improve business efficiency and effectiveness.
In: Computer Science
What does each letter in ACID stand for in the context of database transactions? Describe a concrete example (i.e. a scenario) to illustrate the property the letter "I" refers to, in terms how it works or how it breaks in the example.
In: Computer Science
Reading code that you haven't written is a skill you must develop. Many times you are correcting this code that you didn't write so you have to 1) read the code, 2) find the errors, and 3) correct them.
You are going to correct a program that has several errors in it (specifically, one error per function).
When the program is correct, it should have output like this:
Enter 3 test scores: Enter your test score > 100 Enter your test score > 90 Enter your test score > 91 Wow! You scored 90 or above on all your exams! Keep up the As! Your test average is 93.66666666666667 You earned an A
# Describe the error found in this function:
#
def get_grade():
grade = input("Enter your test score > ")
return grade
# Describe the error found in this function:
#
def all_As(test1, test2, test3):
if test1 > 89:
if test2 > 89:
if test3 > 89:
print("Wow! ", end="")
print("You scored 90 or above on all your exams!")
print("Keep up the As!")
print()
# Describe the error found in this function:
#
def calc_average(test1, test2, test3):
return test1 + test2 + test3 / 3
# Describe the error found in this function:
#
def letter_grade(grade):
if grade >= 90:
print("You earned an A")
if grade >= 80:
print("You earned an B")
if grade >= 70:
print("You earned an C")
if grade >= 60:
print("You earned an D")
if grade < 60:
print("You earned an F")
from grades import (
all_As,
calc_average,
get_grade,
letter_grade
)
# THERE ARE NO ERRORS IN THE MAIN
# YOU DO NOT NEED TO CHANGE THE MAIN
#-----main-----
print("Enter 3 test scores:")
first_test = get_grade()
second_test = get_grade()
third_test = get_grade()
print()
all_As(first_test, second_test, third_test)
average = calc_average(first_test, second_test, third_test)
print("Your test average is",average)
letter_grade(average)
In: Computer Science
In: Computer Science
a)The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________.
b)The decimal equivalent of the unsigned 8-bit hex number 0B4H is ______________.
c)The value of the expression ‘H’ – ‘B’ is less than / equal to / greater than that of the expression ‘L’ – ‘C’.
d)If the .data segment contains declarations
A BYTE 2 DUP (‘a’), ‘+’
B BYTE 3 DUP (‘b’), 0
C BYTE 4 DUP (‘c’), ‘–’
D BYTE 5 DUP (‘d’), 0
then the instruction
input A, D, 6
will display a Windows dialog box with title _______________________________.
f)If eax = 302B59A1H, and ebx = 700CD37DH, then the instruction
add ax, bx
will leave the value ______________________________ in the eax register.
In: Computer Science
Hey guys,
So it seems like I made a slight error in my program. So one of the requirement for this program is not to show any negatives shown as a output, however my program showed some negative numbers. I was wondering if someone could look over my program and find the error and maybe give it a tweak. I don't want to change my program because I worked so hard for it. Anyway here the assignment at the bottom is my code. Thanks in advance:
In this program, you are to store information about sales people and their individual sales from a company. You are to store the first name and quantity sold for each transaction.
You are to allow records to be stored for sales transactions. In fact, you need to ask the user for the total possible number of sales.
You are to allow data entry of 0 to maximum number of transaction. You are to store in the computer the income for each person for each transaction. No negative sales permitted. Here are the rules for calculating income:
The income for a person is progressive. He or she makes money for the first 5 items sold + money from the next 5 items sold + money for the next 500 items sold + the money for any other sale.
The program will have three options: * Record a new sale, * Show income from each existing sales transaction, * Quit
Example output
Name Total Items Sold Total Income
Tom 1 $5.00
Mary 5 $25.00
Willie 7 $35.00
Jack 511 $12,610
My code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
float incomePower(int itemSold){
float incomes;
int numbers = 4;
int breakpoints[] = {0, 5, 5+5, 5+5+500};
float rates[] = {5.0, 10.0, 25.0, 35.0};
for (int roc = 0; roc < numbers; roc++) {
if (itemSold <= breakpoints[roc]) {
break;
}
if ( roc < numbers - 1 && itemSold >= breakpoints[roc + 1]) {
incomes += rates[roc] * (breakpoints[roc + 1] - breakpoints[roc]);
} else {
incomes += rates[roc] *(itemSold - breakpoints[roc]);
}
}
return incomes;
}
int main(){
int megaSale = 0, roc = 0, arrayPointer = 0;
printf("\nThe total income of sales of each Person\n");
printf("\nEnter the maximum number of sales: \n");
scanf("%d", &megaSale);
char names[megaSale][100];
int itemsold[megaSale];
float totalincome[megaSale];
while (1) {
int choice;
printf("Choose:");
scanf("%d", &choice);
switch (choice) {
case 1:
printf("Enter the name of sales person");
scanf("%s", names[arrayPointer]);
printf("Enter the number of sale of %s: ", names[arrayPointer]);
scanf("%d", &itemsold[arrayPointer]);
totalincome[arrayPointer] = incomePower(itemsold[arrayPointer]);
arrayPointer += 1;
break;
case 2:
printf("\nName\t\tTotal Items Sold\t\tTotal Income");
for (roc = 0; roc <arrayPointer; roc++) {
printf("\n%s\t\t\t%d\t\t\t%.2f\n", names[roc], itemsold[roc], totalincome[roc]);
}
break;
case 3:
exit(0);
break;
default:
printf("Invalid entry");
}
}
return 0;
}
In: Computer Science
Discuss in 500 words or more federated architecture in cloud systems. Remember that this is a cloud class not a database class
Note-Check in chegg writing before you submit it should be 100% unique and don't submit the existing chegg answers,and submit in text format
Provide References
In: Computer Science
In: Computer Science
Write a paragraph to reflect on what you have learned in this assignment in terms of the difference between relational databases versus spreadsheets. Discuss ways in which a relational database could be useful for your work (if you have a job) or for your personal or professional projects (if you are a full-time student)
In: Computer Science
void main()
{
Grade g1; //object for grade
char h;
cout << "enter character" ;
cin>>h; //getting value
g1.grade(h);
g1.print();
getch();
}
create an output file (named “output.txt”), and save the character to this output file. Last, close this output file
In: Computer Science
(C++) I'm getting a few errors that prevents the program from running what is causing this?
"
routes3.cpp:202:9: warning: add explicit braces to avoid dangling else
[-Wdangling-else]
else {
^
"
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <cstring>
using namespace std;
class Leg{
const char* const startCity;
const char* const endCity;
const int dist;
public:
Leg(const char* const, const char* const, int);
Leg& operator= (const Leg&);
int getDist() const {return dist;}
void output(ostream&) const;
friend class Route;
friend class ShortestRoute;
};
class Route{
friend class ShortestRoute;
vector<const Leg*> legs;
const int dist;
public:
Route(const Leg&);
Route(const Route&, const Leg&);
Route& operator=(const Route&);
int getDistance() const {return dist;}
void output(ostream&) const;
friend bool operator<(const Route&, const Route&);
};
class ShortestRoute
{
static const int legSize;
static const Leg legs[];
public:
static const Route anyRoute(const char* const, const char*
const);
static const Route shortestRoute(const char* const, const char*
const);
};
const Leg ShortestRoute::legs[] =
{
Leg("Denver", "Kansas City", 395),
Leg("Philadelphia", "New York", 96),
Leg("Oklahoma City", "Kansas City", 347),
Leg("San Jose", "Las Vegas", 382),
Leg("San Fransisco", "San Jose", 42),
Leg("San Jose", "Los Angeles", 306),
Leg("Albuquerque", "Dallas", 646),
Leg("Pittsburgh", "New York", 371),
Leg("Los Angeles", "Phoenix", 372),
Leg("Phoenix", "Albuquerque", 421),
Leg("Las Vegas", "Albuquerque", 573),
Leg("Sacramento", "Reno", 138),
Leg("Memphis", "Atlanta", 383),
Leg("Albuquerque", "Kansas City", 617),
Leg("Albuquerque", "Oklahoma City", 541),
Leg("Oklahoma City", "St Louis", 498),
Leg("Cincinnati", "Columbus", 102),
Leg("Cincinnati", "Cleveland", 217),
Leg("Oklahoma City", "Memphis", 467),
Leg("Dallas", "Memphis", 451),
Leg("Richmond", "Washington", 109),
Leg("Chicago", "Indianapolis", 183),
Leg("Indianapolis", "Cincinnati", 115),
Leg("Los Angeles", "Las Vegas", 263),
Leg("Los Angeles", "Albuquerque", 789),
Leg("Louisville", "Cincinnati", 100),
Leg("St Louis", "Indianapolis", 243),
Leg("Washington", "Baltimore", 39),
Leg("Baltimore", "Philadelphia", 105),
Leg("Las Vegas", "Denver", 754),
Leg("Las Vegas", "Salt Lake City", 420),
Leg("Reno", "Salt Lake City", 518),
Leg("Salt Lake City", "Denver", 519),
Leg("Kansas City", "Chicago", 510),
Leg("Memphis", "Louisville", 383),
Leg("San Fransisco", "Sacramento", 90),
Leg("Memphis", "Nashville", 210),
Leg("Kansas City", "St Louis", 249),
Leg("Nashville", "Charlotte", 409),
Leg("Atlanta", "Charlotte", 226),
Leg("Detroit", "Cleveland", 169),
Leg("Cleveland", "Pittsburgh", 134),
Leg("Louisville", "Richmond", 563),
Leg("Pittsburgh", "Washington", 241),
Leg("Pittsburgh", "Philadelphia", 304),
Leg("Chicago", "Detroit", 283),
Leg("Columbus", "Pittsburgh", 142),
Leg("Charlotte", "Richmond", 291),
//SF to NY SuperHighway
Leg("San Fransisco", "New York", 21000)
};
int main(){
cout << endl << "Programmer: \n";
cout << "Course: \n";
const Route route1 = ShortestRoute::anyRoute("San Francisco",
"New York City");
route1.output(cout);
const Route route2 = ShortestRoute::shortestRoute("San
Francisco", "New York City");
route2.output(cout);
return 0;
}
const Route ShortestRoute::anyRoute(const char* const start,
const char* const end) {
for (int i = 0; i < ShortestRoute::legSize; i++) {
if (strcmp(ShortestRoute::legs[i].endCity, end) == 0) {
if (strcmp(ShortestRoute::legs[i].startCity, start) == 0) {
Route r(legs[i]);
return r;
}
else {
Route
x(ShortestRoute::anyRoute(start,ShortestRoute::legs[i].startCity),legs[i]);
return x;
}
}
}
throw "Can't find a possible route!";
}
const Route ShortestRoute::shortestRoute(const char* const
start, const char* const end){
set<Route> s;
for (int i = 0; i < ShortestRoute::legSize; i++) {
for (int j = 0; j < ShortestRoute::legSize; j++) {
if (strcmp(ShortestRoute::legs[i].endCity, end) == 0)
if (strcmp(ShortestRoute::legs[i].startCity, start) == 0) {
Route r(legs[i]);
return r;
}
else {
Route x(ShortestRoute::anyRoute(start,
ShortestRoute::legs[i].startCity), legs[i]);
s.insert(x);
}
}
}
return *(s.begin());
}
bool operator<(const Route& a, const Route& b)
{
return a.dist < b.dist;
}
Leg& Leg::operator=(const Leg& copy){
Leg& host = *this;
if(this != ©){
const_cast<const char*&>(host.startCity) =
copy.startCity;
const_cast<const char*&>(host.endCity) =
copy.endCity;
const_cast<int&>(host.dist) = copy.dist;
}
return host;
}
void Leg::output(ostream& os) const{
os << startCity << " to " << endCity << "
is " << dist << " miles" << endl;
}
Route::Route(const Leg& leg) : dist(leg.getDist()){
legs.push_back(&leg);
}
Route::Route(const Route& route, const Leg& leg)
: legs(route.legs), dist(route.dist+leg.dist){
if (strcmp(route.legs.back()->endCity, leg.startCity) !=
0)
throw "Mismatch";
legs.push_back(&leg);
}
void Route::output(ostream& os) const{
string output = "Route: ";
string temp = " to ";
int totalDist = 0;
for(int i = 0; i < legs.size(); i++){
output += legs[i]->startCity;
if(i != legs.size()-1) {
output += temp;
}
else{
output += (temp + legs[i]->endCity);
}
totalDist += legs[i]->getDist();
}
output += (" "+to_string(totalDist)+" miles\n");
os << output;
}
Route& Route::operator=(const Route& copy){
Route& host = *this;
if(this != ©){
const_cast<int&>(host.dist) = copy.getDistance();
host.legs = copy.legs;
}
return host;
}
In: Computer Science
For this exercise, you will implement two programs that allow the user to enter grades in a gradebook. The first program will use one‐dimensional arrays, and the second program will use two‐dimensional arrays. The two programs function the same
Write an application that prints out the final grade of the students in a class and the average for the whole class. There are a total of 3 quizzes. You will need 4 arrays:
1. An array of type int to store all the ID's
2. An array of type double to store all scores for quiz 1
3. An array of type double to store all scores for quiz 2
4. An array of type double to store all scores for quiz 3
How to proceed:
1. Ask the user how many students are in the class, so you can set the length of all the arrays.
2. Allocate 4 arrays that will store the data.
3. Use a FOR loop to retrieve and store all the data.
4. Use another FOR loop to
a. Output the final score for each student.
b. Keep track of all scores to later compute the average for the class.
5. Calculate and Output the average for the class.
Format all floating‐point numbers to 2 decimal places
Your program MUST receive user input as shown in the sample output.
Please leave comments on the program so i can give you a thumbs up :)!
Also, this is for java language.
In: Computer Science