Python programming problem!
Suppose that there is a json file called data from the desktop. I want to print the value with the key of "year" and "country".
Json file below:
{
"A":{
"year":11,
"grade":A,
"country":America},
"B":{
"year":18,
"grade":C,
"country":England},
"C":{
"year":19,
"grade":B,
"country":China},}
I want a code that I can only replace the name of key from year to grade and the code could be work.
In: Computer Science
Evaluate the performance in general on two real applications of sorting algorithms in parallel computing. Support your description with diagrams and examples where it is necessary.
In: Computer Science
Consider the following history H:
T2:R(Y), T1:R(X), T3:R(Y), T2:R(X), T2:W(Y), T2:Commit, T1:W(X), T1:Commit, T3:R(X), T3:Commit
Assume that each transaction is consistent.
Does the final database state satisfy all integrity constraints? Explain.
In: Computer Science
Plz, use NETBEANS 8.1 or 8.2 to solve it. Mention every answer to it's question
Thank u
Create a new Java Application to manage Linked Lists: (Note: Do not use java.util.LinkedList)
a) Create a Clock class
1. Add hour, minute, and second as attributes
2. Add a constructor and a toString() method
3. Implement the Comparable interface, and add a CompareTo() method
4. Add methods to get and set all attributes.
b) Add to MyLinkedList class the following methods:
1. Insert a node at the front of the list
2. Insert a Node in place, assuming that the list is ordered in ascending order.
3. Delete node in front
4. Delete last node
5. Method to return the size of the list
6. Method to find the node with the minimum value in the list – getMinimum()
c) Create a Test3 class to do the following in the main method:
1. Create a new List (call it clockList) of type MyLinkedList
2. Insert five Clock objects numbers to the list (not ordered).
3. Display all the clocks in the List
4. Sort the List and display it in both ascending and descending
5. Display the largest element in the list
6. Display the smallest element in the list
7. Display the size of the list
8. Search for a particular clock in the List by printing true if found or false.
9. Delete a clock from the front of the list
10. Delete a clock from the back of the list
11. Order the list in ascending order
12. Insert a new clock elements to its appropriate position in the List and display it
In: Computer Science
Write a program to remove extra blanks from text files. Your program should replace any string of two or more blanks with one single blank. It should work as follows:
* Create a temporary file.
* Copy from the input file to the temporary file, but do not copy
extra blanks. * Copy the contents of the temporary file back into
the original file.
* Remove the temporary file.
Your temporary file must have a different name than any existing file, so that no files other than the input file are changed. Your program should ask the user for the name of the file to be edited, but should not request a name for the temporary file. Instead, generate the name within the program. You can generate the temporary file using any strategy that is clear and efficient. For example, you could start with a name like TempX and check if that name already exists. If it doesn't, you can use that name for the temporary file; if it does exist, append additional random letters to the filename until you find a name that isn't already used.
Language is in C++
In: Computer Science
10. What are the different types of replication topologies?
In: Computer Science
Explain the difference between common carriers, broadcasters, and publishers with regard to court decisions covering freedom of speech and control of content.
In: Computer Science
Locate a data visualization on the web that you think is good. Provide the web address (URL) to the visualization.
In: Computer Science
Write a small C++ program with 4 functions (and main():
The main function will call those methods and print the results of each.
1 // declare
necessary variables
2 // declare array
3 double numbers[SIZE];
4 // Function prototypes
5
6 int main() {
7 // call getNumbers()with appropriate parameters passed
8 // print results of getNumbers()
9 // call and print results of findMax()
10 // call and print results of findMin()
11 // call and print results of find() when
element is found
12 // call and print results of find() when
element is not found
13 return 0;
14 }
.
In: Computer Science
Problem Statement – Gymnastics Contest Java
The Adelaidean Gymnastics Federation is an organisation devoted to running the best Gymnastics contests in all of Adelaide.
In 2031, the School of Computer Science from the University of Adelaide was chosen to develop the Gymnastic Contest software. The competition has few criteria. The winner of the competition must demonstrate skills of good balance. Competitors must have the ability to jump high. A contestant should demonstrate coordination, strength and exhibit aesthetics during their routine. In this final project we require you to design all the features and functionalities for this event to happen.
We are focused on the final for this contest, when each finalist will be judged by the five skills aforementioned in a scale from 0.0 to 10.0. Besides, this the system also has to store competitors name, age and suburb and each finalist contains a moto, like “ I can bounce higher than anyone else!”
Requirements:
Design and develop the classes Contestant, Finalist and Contest.
● [30 % marks] Contestant: consist of a competitor;
● [30% marks] Finalist: consist of a Contestant Competitor that got into the finals in the gymnastics competition.
● [40 % marks] Contest : basic functionalities to guarantee that the contest will
happen; Specifications for the class Contestant:
Design and develop the classes Contestant, Finalist and Contest.
The class Contestant is a general class that represent any sort of competitor;
Requirements:
1. Implement the accessors and mutators;
2. Implement the parameters constructors;
a. Name, suburb, age;
b. Name, suburb, age and the skils: balance, jump, coordination, strength, aesthetics;
3. Implement function getMean(): this method aims to return the mean score of all skills from a Contestant;
Constraints:
1. Comment this code to acquire code style marks;
2. This problem represents 30% of your marks
a. Full marks: use abstraction, implement 1,2,3;
b. Half marks: implement at least 1,2;
c. No marks: doesn’t compile;
Specifications for the class Finalist:
/* * * * * * * *
class Finalist
This class inherit properties from the class Contestant.
This class aims to represent the Finalist of gymnastics contest for 2031
Requirements:
1. Implement the accessors and mutators;
a. moto;
2. Implement method display which displays each field of this contestant on a separate line with the name of the field then a “:” and then the value of the fields;
Constraints:
1. This problem represents 30% of your marks
a. Full marks: use inheritance, implement 1,2;
b. Half marks: implement at least 1,2;
c. No marks: doesn’t compile;
2. Observe that the property moto belongs to Finalist;
class Contest
This class depends on the data structure FinalistList containing items of the class Finalist.
This class aims to represent the Gymnastics Contest Final for the year 2031.
Requirements:
For the class Contest:
1. Implement method addFinalist;
2. Implement a method sortFinalist; that sorts by the mean of skills.
3. Implement the method printFinalists;
Constraints:
1. There are no restrictions regarding what resources use in order to implement this problem; it means that you can use either array, list, linked lists, etc...
2. There is a MAX NUMBER of 5 Finalists;
3. This problem represents 40% of your marks
a. Full marks: use linked list, and implement 1,2,3
b. Half marks: use array implement at least 2 out of 3;
c. No marks: doesn’t compile;
Details
addFinalist will take a Finalist as a parameter and add the finalist to the list if the number of finalist is beyond MAX_NUMBER an IndexOutOfBoundsException should be thrown.
sortFinalist will sort the FinalistList structure by the mean of the skills of the Finalists.
printFinalist will print the members of FinalistLists by calling display on each of the Finalist in
that list in the order they appear in that list.
In: Computer Science
Python 3
Add a drop down menu (label tag "Working product: " option values: yes, no ) and it should be stored in the xlsx file
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
HOW DO I ACCESS THE HEAD OF A LINKED LIST FROM INT MAIN () WHEN IT'S IN ANOTHER CLASS. HERE IS MY CODE FOR MY MAIN AND HEADER FILES.
HEADER FILE:
#ifndef HANOISTACK_H
#define HANOISTACK_H
#include <iostream>
using namespace std;
class HanoiStack { //class
private:
struct Disc{ //linked list for towers
int num;
Disc* next;
};
Disc* head;
public:
HanoiStack(){ //constructor
head = nullptr;
};
//HanoiStack operator+=(const Disc&);
//HanoiStack operator<<(const Disc&);
void push(int); //push function
int pop(); //pop function
void display(int);//prints pegs
};
#endif
MAIN FILE
int main(){
//class objects
HanoiStack peg;
HanoiStack temp1;
HanoiStack temp2;
HanoiStack temp3;
//integer variables
int num, solved, choice, end, removed, count = 0, tower;
//win condition variable
bool won = false;
cout << "Enter the number of disks" << endl;
cin >> num;//enters the number of disks
while (num > 0 && num < 10){ //confirmation
loop
cout << "Error wrong entry try again" << endl;
cout << "Enter the number of disks" << endl;
cin >> num;
}
if (num > 0 && num < 10){
solved = pow(2, num)-1; //minimum number of moves required to
win
}
for (int i = num; i > 0; i--){
peg.push(temp1); //inserts disks onto tower
}
In: Computer Science
Suppose that a block can contain at most four data values and that all data values are integers. Using only B+ trees of degree 2, give examples of each of the following :
a. A B+ tree whose height changes from 2 to 3 when the value 42 is inserted. Show your structure before and after the insertion.
b. A B+ tree in which the deletion of the value 42 leads to a redistribution. Show your structure before and after the deletion
In: Computer Science
In the C programming language, implement the translation from regular English to Euroglish. If the letters were uppercase, keep them uppercase in the replacement.
1. Remove one“e”from the end of words that are more than three characters long, if they happen to end in “e”.
2. Change all double letters to a single letter (including double spaces). Do not remove double line spacing (i.e. “\n”).
3. When a word ends in “ed”, change that to just “d”.
Text:
The cat in the hat roamed around the world.
Here is a weird sentence.
We love to code
They fumed and fumed. They laughed and laughed
Better a bird in the hand than two in the tree.
In: Computer Science
2 – The CPU design team is designing an instruction set with three classes of instructions. Parameters are given in the following table. Consider a program with 65% ALU instructions, 20% memory access instructions, and 15% control instructions. What is the average CPI for this CPU?
Clock Rate: 4GHz
CPI for ALU Inst.: 4
CPI for Memory Inst.: 8
CPI for Control Inst.: 2
In: Computer Science