Code should be Written in C
Use the data from the example below.
Candidates Subdivisions Totals
Brampton Pickering Markham
Aubrey 600 800 800 2200
Blake 700 700 600 2000
Chubbs 800 700 800 etc
Oliver 400 450 300
Zamier 900 900 900
Totals 3400 etc etc
In: Computer Science
AWS(Amazon Web Services):
As an organization grows, what are some aspects to consider with regard to EC2 Instances, EBS, and Elastic IPs if any (i.e. aspects to consider: architectural, performance, cost, etc.)?
In: Computer Science
You are writing a billing program that adds up the items a user enters. Your program should use a loop and prompt the user for the item number for each item in inventory to add to the bill. (You can ask the user for the number of items you will enter and use a counter controlled loop or a sentinel controlled loop that has a stop number. Either way is fine.) Here is the table of items in inventory:
Item Value
1 209.00
2 129.50
3 118.00
4 232.00
(So if your program starts asking the user for the items they are purchasing and they enter item 2 with quantity 2, and item 3 with quantity 1. The bill should be 377.00. On the next run if your program asks the user for items in the loop and they give enter each item with quantity of 1. The bill should be 688.50
[You must use an IF or IF/Else Structure to look up the item value for the item number they give or you are missing an objective on this assignment.] Use Java and NetBeans *.0 version to solve this. Must use a simple loop and nested if statement.
In: Computer Science
Create a driver class to do the following:
a.
Read data from the given file BankData.data and create and array of BankAccount Objects
The order in the file is first name, last name, id, account number, balance. Note that account
name consists of both first and last name
b.
Print the array (without account id) the account balance must
show only 2 decimal digits. You will need to do some string processing.
c.
Find the account with largest balance and print it
d.
Find the account with the smallest balance and print it.
e.
Determine if there are duplicate accounts in the array. If there are then set the duplicate account
name to XXXX XXXX and rest of the fields to 0. Note it’s hard to “delete” elements from an array.
Or add new accounts if there is no room in the array. If
duplicate(s) are found, print the array.
Main.cpp
#include <iostream>
#include <fstream>
#include <string>
#include //your header file
using namespace std;
const int SIZE = 8;
void fillArray (ifstream &input,BankAccount
accountsArray[]);
int largest(BankAccount accountsArray[]);
int smallest(BankAccount accountsArray[]);
void printArray(BankAccount accountsArray[]);
int main() {
//open file
//fill accounts array
//print array
//find largest
//find smallest
//find duplicates and print if necessary
BankAccount accountsArray[SIZE];
fillArray(input,accountsArray);
printArray(accountsArray);
cout<<"Largest Balance:
"<<endl;
cout<<accountsArray[largest(accountsArray)].toString()<<endl;
cout<<"Smallest Balance
:"<<endl;
cout<<accountsArray[smallest(accountsArray)].toString()<<endl;
}
}
void fillArray (ifstream &input,BankAccount
accountsArray[]){
}
int largest(BankAccount accountsArray[]){
//returns index of largest account balance
}
int smallest(BankAccount accountsArray[]){
//returns index of smallest
}
BankAccount removeDuplicate(BankAccount account1, BankAccount
account2){
return (account1.equals(account2));
}
void printArray(BankAccount accountsArray[]){
cout<<" FAVORITE BANK - CUSTOMER DETAILS
"<<endl;
cout<<"
--------------------------------"<<endl;
//print array using to string method
}
BankData.data
Matilda Patel 453456 1232 -4.00 Fernando Diaz 323468 1234 250.0 Vai vu 432657 1240 987.56 Howard Chen 234129 1236 194.56 Vai vu 432657 1240 -888987.56 Sugata Misra 987654 1238 10004.8 Fernando Diaz 323468 1234 8474.0 Lily Zhaou 786534 1242 001.98
In: Computer Science
Could someone please tell me what corrections I should make to this code. (Python)
Here are the instructions.
I can't get the find function to work and I have no idea how to even go about it. For example, when type in 'find' and I enter the rating, I'm always getting an error. I need help.
def list(movie_list):
if len(movie_list) == 0:
print("There are no movies in the list.\n")
return
else:
i = 1
for row in movie_list:
print(str(i) + ". " + row[0]+ " (" + str(row[1]) + ")"+","+
"$"+str(row[2])+","+str(row[3]))
i += 1
print()
def add(movie_list):
name = input("Name: ")
year = input("Year: ")
price = int(input("Price:"))#price
rating =input("Rating:")
movie = []
movie.append(name)
movie.append(year)
movie.append(price)#adding price to the movie list
movie.append(rating)#adding rating to the movie list
movie_list.append(movie)
rating_list.append(movie)
print(movie[0] + " was added.\n")
def delete(movie_list):
number = int(input("Number: "))
if number < 1 or number > len(movie_list):
print("Invalid movie number.\n")
else:
movie = movie_list.pop(number-1)
print(movie[0] + " was deleted.\n")
#find by rating function
def find_by_rating(movie_list,rating):
if len(movie_list)==0:
print("Find")
return
else:
movie_list=[]
for i in movie_list:
if i[3]==rating:
movie_list.append(i[0])
if len(1)==0:
print("No movies are present with given rating")
else:
print("Movies:")
for i in movie_list:
print(i)
def display_menu():
print("COMMAND MENU")
print("list - List all movies")
print("add - Add a movie")
print("del - Delete a movie")
print("find- find movie by rating")
print("exit - Exit program")
print()
def main():
movie_list = [["Matrix",1999,9.75,"R"],
["Under the Tuscan",2003,4.99,"PG"],
["V for Vendetta", 2005,14.99,"R"]]
display_menu()
while True:
command = input("Command: ")
if command == "list":
list(movie_list)
elif command == "add":
add(movie_list)
elif command == "del":
delete(movie_list)
elif command == "find": #added find command
rating=input("Enter rating:")#taking the rating
find_by_rating(movie_list,rating)#the call
elif command == "exit":
break
else:
print("Not a valid command. Please try again.\n")
print("Bye!")
if __name__ == "__main__":
main()
In: Computer Science
Write a C++ program that takes two sets ’A’ and ’B’ as input read from the file prog1 input.txt. The first line of the file corresponds to the set ’A’ and the second line is the set ’B’. Every element of each set is a character, and the characters are separated by space. Implement algorithms for the following operations on the sets. Each of these algorithms must be in separate methods or subroutines. The output should be written in the file prog1 output.txt. Write a title before the output of each operation. 1. Union 2. Intersection 3. A - B 4. Decide if (A ⊂ B). Program 2 – 50 points Write a program that takes three sets ’A’, ’B’, ’C’ as input read from the file prog2 input.txt. The first line of the file corresponds to the set ’A’, the second line is the set ’B’, and the third line is the set ’C’. Every element of each set is a character, and the characters are separated by space. Implement algorithms for the following operations on the sets. Each of these algorithms must be in separate methods or subroutines. The output should be written in the file prog2 output.txt and the standard output. Write a title before the output of each operation. 1. (A∪B)∪C. 2. A∪(B∩C). 3. (A∪B)∩(A∪C). HINTS You may want to use arrays. Pay special attention to the parentheses because they indicate the order. For example: (A ∪ B) ∪ C means to compute (A ∪ B) first, and then ∪C. Consider reusing the algorithms for union and intersection that you have defined already. For example, to compute (A ∪ B) ∪ C: First, compute A ∪ B using the function that computes the union that you already defined. Let’s say that you store that result in an array R. Then, compute R ∪ C using the function that computes the union that you already defined.
In: Computer Science
1. Articulate the aspects of the university environment to
consider as they adopt and implement ERM.
2. Describe the differences between formal structural and collegial
organizational models as they relate to goal setting, decision
making, and leadership.
3. Analyze strategies utilized at one higher education institution
to adopt ERM processes to fit the decentralized academic
environment.
In: Computer Science
Reimpelment a function called bubble_sort that has the following prototype.
bubble_sort(int *array, int size, pointer to a function)
Pre condition
array - a pointer to a an array of size element.
pointer to function - a pointer to a function that compares two
values (depending on sorting in ascending order or descending
order)
Post condition
Sort the array in ascending or descending based on the the pointer
to a function.
Call the function bubble_sort to sort the array in
ascending
Display the sorting array.
Call the function bubble_sort to sort the array in descending
Display the sorting array.
use a list of integers from a file called data.txt
Here is the content of the file data.txt.
9
8
4
7
2
9
5
6
1
3
In: Computer Science
Suppose you have developed a social media management tool that
you’ve made available as a service to everyone on your office
network. Due to its success, you plan to expand by publicizing and
providing the service to any client on the World Wide Web.
What problems might you expect as your service is requested by an
increasing number of clients, and what are some of the things you
might do to solve the problems?
In: Computer Science
6.27 Ch 2 Program: Painting a wall (C++)
(4)Calculate the cost of the paint. Paint comes in six colors (Red,
Yellow, Green, Blue, Black,White) Assign numbers 0-5 to these paint
colors ie Red =0 and White =5. The costs for each of these paints
is as follows:(2 pts) Now your program will be submission
ready.
Main.cpp
#include <iostream>
#include <cmath>
using namespace std;
#include "paint.h"
int main() {
double wallHeight;
double wallWidth;
double wallArea;
double gallonsPaintNeeded;
int cansNeeded,colorNum;
Color paintColor;
double costArray[numOfColors];
cout << "Enter wall height (feet):
"<<endl;
cin >> wallHeight;
cout << "Enter wall width (feet):
"<<endl;
cin >> wallWidth;
cout<< "Enter paint color as an
integer"<<endl;
cout<<"Red - Enter
0"<<endl;
cout<<"Blue - Enter 1"<<endl;
cout<<"Green - Enter 2"<<endl;
cout<<"Yellow- Enter 3"<<endl;
cout<<"Black - Enter 4"<<endl;
cout<<"White - Enter 5"<<endl;
cout<<"Your color ?"<<endl;
cin>>colorNum;
paintColor= (Color)colorNum; // cast the integer to
type Color
// Calculate and output wall area
// FIXME (1): Calculate the wall's area
cout << "Wall area: " << wallArea <<
" square feet" << endl; // FIXME (1): Finish the
output statement
// FIXME (2): Calculate and output the amount of paint
in gallons needed to paint the wall
cout << "Paint needed: " <<
gallonsPaintNeeded << " gallons" << endl;
// FIXME (3): Calculate and output the number of 1
gallon cans needed to paint the wall, rounded up to nearest
integer
cout << "Cans needed: " << cansNeeded
<<" can(s)" << endl;
//FIX ME (3) populate the cost Array and calculate the
total cost of the paint
cout << "TotalCost: $" << totalCost<<" for
"<<cansNeeded;
switch (paintColor){
case Red: cout<<" Red";
break;
case Blue: cout<<" Blue";
break;
case Green: cout<<" Green";
break;
case Yellow: cout<<" Yellow";
break;
case Black: cout<<" Black";
break;
case White: cout<<" White";
break;
}
cout<<" can(s)" << endl;
return 0;
}
paint.h
#include<fstream>
const double squareFeetPerGallons = 350.0;
const double
gallonsPerCan =
1.0;
const int numOfColors =6;
enum Color {Red, Blue, Green, Yellow, Black,White};
double calculateWallArea(double height, double width){
// height times width
}
double calculatePaintAmount(double wallArea){
//wallarea divided by square feet per gallons
}
int calculateNumberOfCans(double paintAmount){
return ceil(paintAmount/gallonsPerCan); // round up the number of
cans needed
}
void getColorCost(double costArray[]){
//open the data file and read into array
}
double calculateCost(Color paintColor, double costArray[],double
numOfCans ){
// the cost of paint given the color and number of cans
}
cost.txt
1.99
2.99
0.99
2.99
0.49
0.99
In: Computer Science
Traditional banking versus mobile or online banking 1. Discuss an assumption and an associated claim. 2. Based on your selection, describe the main concepts and metaphors that have been used for each (include a marked-up graphic with your description). 3. Describe how they differ. 4. Describe the aspects of the paper-based artifact that informed the digital app. 5. Describe the new functionality and articulate the pros and cons.
In: Computer Science
Company XYZ owns a social network web site dedicated for wind surfers. They plan to launch a new online ad delivery and management service web site that will be coupled with their existing social network platform. The online ad management service will enable them to accept online orders for online ads from advertisers. The system will also deliver the ads to the main social network site. The ads will be displayed on the social network site but the content of the ads (the images and/or text objects containing the ad message) will be served by the new web site server. The company forecasts that the web site will receive an average of 10,000 visits from potential or current advertisers and 600 online ad purchase orders per week. They expect to have 30,000 registered online advertisers during the first month of the launch of the web site. Company XYZ dedicate a separate server and database for the new online service. The users of the ad management site and the users of the social network will be managed separately. The data of the two groups will be stored on separate databases. Similarly, web ad management site content and the social network site content will be hosted on separate servers. Company XYZ prefers to manage those two sites separately. The social network site will pull online ads from the database of the online ad management system. The users will experience a seamless presentation of ads within the social network pages without noticing the ads are fed from a different server.
Company XYZ awarded a contract to your company (Company ABC) to develop the web site, web service, and the database that will provide the capability of the online ad delivery and management service. You are the project manager of this project. Your task is to manage a team of three (one graphic designer, one database developer, and one software developer). As the project manager you are required to answer the following questions that provide insight about the project plan. Please respond to each question. There may be missing information. This is intentional. If you feel that there is missing information in any question, you are expected to make assumptions. Please state your assumptions clearly. You can use library and/or online information resources to address the questions. List all the information sources you use (use APA format for listing the references).
Using the drawing feature of Word or other software, create a site map of the online ad delivery service and management web site and the ad delivery web service. Show the hierarchy of pages and relationships between them. Include the database infrastructure in your depiction of your website. Explain each element. You can make any assumption about the specifics of the web site. Show the links between the social network site and the online ad management site that you will develop.
In: Computer Science
Ice Cream Program Assignment
Write a program that uses a function to ask the user to choose an ice cream flavor from a menu (see output below.) You must validate the users input for the flavor of ice cream accounting for both upper and lower-case letters. You must give them an appropriate error message and allow them to try again. Once you have a valid flavor, your function will return the flavor back to the main() function.
Your main() function will then ask for the number of scoops. You must validate this data! Make sure that the user chooses at least 1 scoop but no more than 4. If they try another other, you must give them an error message and allow them to try again.
Your program will then calculate and display the cost of the ice cream. The cost of ice cream is $ .75 for the cone and $1.25 per scoop.
Your program will continue asking customers for the flavor and number of scoops until they choose ‘Q’ to quit.
The program will then send all of the data to a function to display the total number of cones sold, the total amount collected, and the total scoops of each type of ice cream sold.
Sample Output:
Please Choose your Favorite Flavor!
V - Vanilla
C - Chocolate
F - Fudge
Q - Quit
-----> v
How many scoops would you like? 2
Your ice cream cone cost $ 3.25 Please Choose your Favorite Flavor!
V - Vanilla
C - Chocolate
F - Fudge
Q - Quit
-----> c
How many scoops would you like? 5
That is an invalid number of scoops! You may only choose between 1 and 4
Please try again!
How many scoops would you like? 0
That is an invalid number of scoops! You may only choose between 1 and 4
Please try again!
How many scoops would you like? 3
Your ice cream cone cost $ 4.50 Please Choose your Favorite Flavor!
V - Vanilla
C - Chocolate
F - Fudge
Q - Quit
-----> s
How many scoops would you like? 1
Your ice cream cone cost $ 2.00 Please Choose your Favorite Flavor!
V - Vanilla
C - Chocolate
F - Fudge
Q - Quit
-----> q
The total number of cones sold: 3
The total scoops of vanilla sold: 2
The total scoops of chocolate sold: 3
The total scoops of fudge sold: 1
The total amount collected: $ 9.75
In: Computer Science
Python 3
Fix the code so the program reads the file and see if the bar code was already inputted 3 times if so, it ishows a warning indicating that the item was already tested 3 times
Code:
import tkinter as tk from tkcalendar import DateEntry from openpyxl import load_workbook from tkinter import messagebox from datetime import datetime window = tk.Tk() window.title("daily logs") window.grid_columnconfigure(1,weight=1) window.grid_rowconfigure(1,weight=1) # labels tk.Label(window, text="Bar code").grid(row=0, sticky="W", pady=20, padx=20) tk.Label(window, text="Products failed").grid(row=1, sticky="W", pady=20, padx=20) tk.Label(window, text="Money Lost").grid(row=2, sticky="W", pady=20, padx=20) tk.Label(window, text="sold by").grid(row=3, sticky="W", pady=20, padx=20) tk.Label(window, text="Failed date").grid(row=4, sticky="W", pady=20, padx=20) # entries barcode = tk.Entry(window) product = tk.Entry(window) money = tk.Entry(window) # arraging barcode.grid(row=0, column=1) product.grid(row=1, column=1) money.grid(row=2, column=1) options = tk.StringVar(window) options.set("Choose one value") # default value soldData = tk.OptionMenu(window, options, "Peter", "John", "Mary", "Jonatan", "Steve") soldData.grid(row=3, column=1) cal = DateEntry(window, width=12, background='darkblue', foreground='white', borderwidth=2) cal.grid(row=4, column=1) def readValue(): excel_barcode = barcode.get() excel_product = product.get() excel_money = money.get() excel_sold = options.get() if excel_sold.strip() == 'Choose one value': messagebox.showwarning("Error", "Please select a value for sold by") return date = datetime.now() print(date) data = [excel_barcode, excel_product, excel_money, excel_sold, date] workbook = load_workbook("dailylog.xlsx") worksheet = workbook.worksheets[0] worksheet.append(data) workbook.save("dailylog.xlsx") cleardate() def cleardate(): barcode.delete(0, 'end') product.delete(0, 'end') money.delete(0, 'end') options.set("Choose one value") # default value today = datetime.now() cal.set_date(today) # button to trigger actions button = tk.Button(text="SUBMIT", command=readValue).grid(row=5, pady=20, padx=20) button = tk.Button(text="CLEAR", command=cleardate).grid(row=5, column=1, pady=20, padx=20) window.geometry("500x400") window.mainloop()
In: Computer Science
Compare client-server systems and peer-to-peer systems in terms of performance, scalability, fault tolerance, and any other feature you think is important.
In: Computer Science