Answer:
class Library: def __init__(self): self.books = [] lib1 = Library()lib1.books.append("Biology") lib1.books.append("Python Programming Cookbook")Explanation:
The solution code is written in Python 3.
Firstly, we can create a Library class with one constructor (Line 2). This constructor won't take any input parameter value. There is only one instance variable, books, in the class (Line 3). This instance variable is an empty list.
To test our class, we can create an object lib1 (Line 5). Next use that object to add the book item to the books list in the object (Line 6-8).
Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string.
Ex: If the input is:
n Monday
the output is:
1
Ex: If the input is:
z Today is Monday
the output is:
0
Ex: If the input is:
n It's a sunny day
the output is:
2
Case matters.
Ex: If the input is:
n Nobody
the output is:
0
n is different than N.
This is what i have so far.
#include
#include
using namespace std;
int main() {
char userInput;
string userStr;
int numCount;
cin >> userInput;
cin >> userStr;
while (numCount == 0) {
cout << numCount << endl;
numCount = userStr.find(userInput);
}
return 0;
}
Box one:
logical
Date and time
Compatibility
Web
Box 2:
&
$
=
#
Box 3:
Not
If
Or
Sum
*Sometimes it is difficult to convince top management to commit funds to develop and implement a SIS why*
Step-by-step Explanation:
SIS stands for: The Student Information System (SIS).
This system (a secure, web-based accessible by students, parents and staff) supports all aspects of a student’s educational experience, and other information. Examples are academic programs, test grades, health information, scheduling, etc.
It is difficult to convince top management to commit funds to develop and implement SIS, this can be due to a thousand reasons.
The obvious is that the management don't see the need for it. They would rather have students go through the educational process the same way they did. Perhaps, they just don't trust the whole process, they feel more in-charge while using a manual process.
The Taylor series expansion for ax is: Write a MATLAB program that determines ax using the Taylor series expansion. The program asks the user to type a value for x. Use a loop for adding the terms of the Taylor series. If cn is the nth term in the series, then the sum Sn of the n terms is . In each pass calculate the estimated error E given by . Stop adding terms when . The program displays the value of ax. Use the program to calculate: (a) 23.5 (b) 6.31.7 Compare the values with those obtained by using a calculator.
Answer: (a). 11.3137
(b). 22.849
Explanation:
Provided below is a step by step analysis to solving this problem
(a)
clc;close all;clear all;
a=2;x=3.5;
E=10;n=0;k=1;sn1=0;
while E >0.000001
cn=((log(a))^n)*(x^n)/factorial(n);
sn=sn1+cn;
E=abs((sn-sn1)/sn1);
sn1=sn;
n=n+1;
k=k+1;
end
fprintf('2^3.5 from tailor series=%6.4f after adding n=%d terms\n',sn,n);
2^3.5 from tailor series=11.3137 after adding n=15 terms
disp('2^3.5 using calculator =11.3137085');
Command window:
2^3.5 from tailor series=11.3137 after adding n=15 terms
2^3.5 using calculator =11.3137085
(b)
clc;close all;clear all;
a=6.3;x=1.7;
E=10;n=0;k=1;sn1=0;
while E >0.000001
cn=((log(a))^n)*(x^n)/factorial(n);
sn=sn1+cn;
E=abs((sn-sn1)/sn1);
sn1=sn;
n=n+1;
k=k+1;
end
fprintf('6.3^1.7 from tailor series=%6.4f after adding n=%d terms\n',sn,n);
disp('6.3^1.7 using calculator =22.84961748');
Command window:
6.3^1.7 from tailor series=22.8496 after adding n=16 terms
6.3^1.7 using calculator =22.84961748
cheers i hope this helped !!!
Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes
Answer:.
// Program is written in C++.
// Comments are used for explanatory purposes
// Program starts here..
#include<iostream>
using namespace std;
int main()
{
// Declare Variables
int amount, dollar, quarter, dime, nickel, penny;
// Prompt user for input
cout<<"Amount: ";
cin>>amount;
// Check if input is less than 1
if(amount<=0)
{
cout<<"No Change";
}
else
{
// Convert amount to various coins
dollar = amount/100;
amount = amount%100;
quarter = amount/25;
amount = amount%25;
dime = amount/10;
amount = amount%10;
nickel = amount/5;
penny = amount%5;
// Print results
if(dollar>=1)
{
if(dollar == 1)
{
cout<<dollar<<" dollar\n";
}
else
{
cout<<dollar<<" dollars\n";
}
}
if(quarter>=1)
{
if(quarter== 1)
{
cout<<quarter<<" quarter\n";
}
else
{
cout<<quarter<<" quarters\n";
}
}
if(dime>=1)
{
if(dime == 1)
{
cout<<dime<<" dime\n";
}
else
{
cout<<dime<<" dimes\n";
}
}
if(nickel>=1)
{
if(nickel == 1)
{
cout<<nickel<<" nickel\n";
}
else
{
cout<<nickel<<" nickels\n";
}
}
if(penny>=1)
{
if(penny == 1)
{
cout<<penny<<" penny\n";
}
else
{
cout<<penny<<" pennies\n";
}
}
}
return 0;
}
g Create your own data file consisting of integer, double or String values. Create your own unique Java application to read all data from the file echoing the data to standard output. After all data has been read, display how many data were read. For example, if 10 integers were read, the application should display all 10 integers and at the end of the output, print "10 data values were read" Demonstrate your code compiles and runs without issue. Respond to other student postings by enhancing their code to write the summary output to a file instead of standard output.
Answer:
See explaination
Explanation:
//ReadFile.java
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class ReadFile
{
public static void main(String[] args)
{
int elementsCount=0;
//Create a File class object
File file=null;
Scanner fileScanner=null;
String fileName="sample.txt";
try
{
//Create an instance of File class
file=new File(fileName);
//create a scanner class object
fileScanner=new Scanner(file);
//read file elements until end of file
while (fileScanner.hasNext())
{
double value=fileScanner.nextInt();
elementsCount++;
}
//print smallest value
System.out.println(elementsCount+" data values are read");
}
//Catch the exception if file not found
catch (FileNotFoundException e)
{
System.out.println("File Not Found");
}
}
}
Sample output:
sample.txt
10
20
30
40
50
output:
5 data values are read
Zoom Vacuum, a family-owned manufacturer of high-end vacuums, has grown exponentially over the last few years. However, the company is having difficulty preparing for future growth. The only information system used at Zoom is an antiquated accounting system. The company has one manufacturing plant located in Iowa; and three warehouses, in Iowa, New Jersey, and Nevada. The Zoom sales force is national, and Zoom purchases about 25 percent of its vacuum parts and materials from a single overseas supplier. You have been hired to recommend the information systems Zoom should implement in order to maintain their competitive edge. However, there is not enough money for a full-blown, cross-functional enterprise application, and you will need to limit the first step to a single functional area or constituency. What will you choose, and why?
Answer:
The best advice for Zoom Vacuum is to start with a Transaction Processing System(TPS). This system will process all the day to day transactions of the system. It is like a real time system where users engage with the TPS and generate, retrieve and update the data. it would be very helpful in lowering the cost of production and at the same time manufacture and produce standard quality products.
Although, TPS alone would not be sufficient enough. so Management Information System(MIS) would be needed, that can get the data from the TPS and process it to get vital information.
This MIS will bring about information regarding the sales and inventory data about the current and well as previous years.
With the combination of TPS as well as MIS is a minimum requirement for a Zoom Vacuum to become successful in the market.
Explanation:
Solution
When we look at the description of the Zoom Vacuum manufacturing company closely, we see that the business is currently a small scale business which is trying to become a small to mid scale business. This claim is supported by the fact that there is only one manufacturing plant and three warehouses. And here, we also need to have the knowledge of the fact that small business major aim is to keep the cost low and satisfy the customers by making good products. So we need to suggest what information system is best suited for small scale business enterprises.
The best recommendation would be to start with a Transaction Processing System(TPS). This system will process all the day to day transactions of the system. It is like a real time system where users interact with the TPS and generate, retrieve and modify the data. This TPS would be very helpful in lowering the cost of production and at the same time manufacture and produce standard quality products . Also TPS can help in communicating with other vendors.
But TPS along would not be sufficient. Also Management Information System(MIS) would be required that can get the data from the TPS and process it to get vital information. This MIS will help in generating information regarding the sales and inventory data about the current and well as previous years. Also MIS can create many types of graphical reports which help in tactical planning of the enterprise.
So a combination of TPS as well as MIS is a minimum requirement for a Zoom Vacuum to become successful in the market.
Dave owns a construction business and is in the process of buying a laptop. He is looking for a laptop with a hard drive that will likely continue to function if the computer is dropped. Which type of hard drive does he need?
Answer:
Solid state drive
Explanation:
The term solid-state drive is used for the electronic circuitry made entirely from semiconductors. This highlights the fact that the main storage form, in terms of a solid-state drive, is via semiconductors instead of a magnetic media for example a hard disk. In lieu of a more conventional hard drive, SSD is built to live inside the device. SSDs are usually more resistant to physical shock in comparison to the electro-mechanical drives and it functions quietly and has faster response time. Therefore, SSD will be best suitable for the Dave.
In Java please:
Palindrome reads the same from left or right, mom for example. There is a palindrome which must be modified, if possible. Change exactly one character of the string to another character in the range ascii[a-z] so that the string meets the following three conditions:
a. The new string is lower alphabetically than the initial string.
b. The new string is the lowest value string alphabetically that can be created from the original palindrome after making only one change.
c. The new string is not a palindrome.
Return the new string, or, if it not possible to create a string meeting the criteria, return the string IMPOSSIBLE.
Example:
palindromeStr = 'aaabbaaa'
O Possible strings lower alphabetically than 'aaabbaaa' after one change are [aaaabaaa', 'aaabaaaa').
O aaaabaaa' is not a palindrome and is the lowest string that can be created from palindromeStr.
Answer:
See explaination
Explanation:
public class PalindromeChange {
public static void main(String[] args) {
System.out.println("mom to non palindrom word is: "+changTONonPalindrom("mom"));
System.out.println("mom to non palindrom word is: "+changTONonPalindrom("aaabbaaa"));
}
private static String changTONonPalindrom(String str)
{
int mid=str.length()/2;
boolean found=false;
char character=' ';
int i;
for(i=mid-1;i>=0;i--)
{
character = str.charAt(i);
if(character!='a')
{
found=true;
break;
}
}
if(!found)
{
for(i=mid+1;i<str.length();i++)
{
character = str.charAt(i);
if(character!='a')
{
found=true;
break;
}
}
}
// This gives the character 'a'
int ascii = (int) character;
ascii-=1;
str = str.substring(0, i) + (char)ascii+ str.substring(i + 1);
return str;
}
}
A customer seeks to buy a new computer for private use at home. The customer primarily needs the computer to use the Microsoft PowerPoint application for the purpose of practicing presentation skills. As a salesperson what size hard disc would you recommend and why?
Answer:
500gbs of ssd storage. Microsoft also allows for multi platform cloud cross-saving.
Explanation:
Help its simple but I don't know the answer!!!
If you have a -Apple store and itunes gift card-
can you use it for in app/game purchases?
Answer:
yes you can do that it's utter logic
Answer:
Yes.
Explanation:
Itunes gift cards do buy you games/movies/In app purchases/ect.
Assume the class Student implements the Speaker interface from the textbook. Recall that this interface includes two abstract methods, speak( ) and announce(String str). A Student contains one instance data, String class Rank. Write the Student class so that it implements Speaker as follows. The speak method will output "I am a newbie here" if the Student is a "Freshman", "I like my school" if the Student is either a "Sophomore" or a "Junior", or "I can not wait to graduate" if the student is a "Senior". The announce method will output "I am a Student, here is what I have to say" followed by the String parameter on a separate line. Finally, the class Rank is initialized in the constructor. Only implement the constructor and the methods to implement the Speaker interface.
Answer:
Check the explanation
Explanation:
Based on the above information, this the following resulting code.
The solution has namely one interface named Speaker, one class called Student and one Main class called StudentMain.
The StudentMain class just initialize various instances of the Student class with various classRank values and then subsequently calling in the speak() methods of all.
announce() method is called on one such instance of Student class to demonstrate its functioning.
Comments are added at required place to better help in understanding the logic.
Speaker.java
public interface Speaker {
abstract void speak();
abstract void announce(String str);
}
Student.java
public class Student implements Speaker {
/*
* Write the Student class so that it implements Speaker as follows.
The speak method will output "I am a newbie here" if the Student is a "Freshman",
"I like my school" if the Student is either a "Sophomore" or a "Junior",
or "I can not wait to graduate" if the student is a "Senior".
The announce method will output "I am a Student, here is what I have to say" followed by the String parameter on a separate line.
*/
String classRank;
// Based on the requirement taking in classRank String as a constructor parameter
public Student(String classRank) {
super();
this.classRank = classRank;
}
// Using the switch-case to code the above requirment
public void speak() {
switch(classRank) {
case "Freshman":
System.out.println("I am a newbie here");
break;
// This case would output the same result for the 2 case conditions
case "Sophomore":
case "Junior":
System.out.println("I like my school");
break;
case "Senior":
System.out.println("I can not wait to graduate");
break;
default:
System.out.println("Unknown classRank inputted");
}
}
//Based on the requirement, first line is printed first after second which is
// the inputted String parameter
public void announce(String str) {
System.out.println("I am a Student, here is what I have to say");
System.out.println(str);
}
}
StudentMain.java
public class StudentMain {
public static void main(String[] args) {
// Initializing all the Objects with required classRank
Student stu1=new Student("Freshman");
Student stu2=new Student("Sophomore");
Student stu3=new Student("Junior");
Student stu4=new Student("Senior");
Student stu5=new Student("Freshman");
//Calling the speak methods of the all the above create objects
stu1.speak();
stu2.speak();
stu3.speak();
stu4.speak();
stu4.speak();
stu4.announce("Wish u all the best");
}
}
Following is the output generated from the code run.
(TCO 4) Give the contents of Register A after the execution of the following instructions:
Data_1 EQU $12
Data_2 EQU %01010101
LDAA #Data_1
ADDA #Data_2
A) $12
B) $67
C) $55
D) $57
Create a class called Hangman. In this class, Create the following private variables: char word[40], progress[40], int word_length. word will be used to store the current word progress will be a dash representation of the the current word. It will be the same length as the current word. If word is set to ‘apple’, then progress should be "‑‑‑‑‑" at the beginning of the game. As the user guesses letters, progress will be updated with the correct guesses. For example, if the user guesses ‘p’ then progress will look like "‑pp‑‑" Create a private function void clear_progress(int length). This function will set progress to contain all dashes of length length. If this function is called as clear_progress(10), this will set progress to "‑‑‑‑‑‑‑‑‑‑". Remember that progress is a character array; don’t forget your null terminator. Create the following protected data members: int matches, char last_guess, string chars_guessed, int wrong_guesses, int remaining. Create a public function void initialize(string start). This function will initialize chars_guessed to a blank string, wrong_guesses to 0. Set remaining to 6. Use strcpy() to set word to the starting word passed as start (You can use start.c_str() to convert it to a character array). Set word_length to the length of word. Call clear_progress in this function.
Answer:
See explaination
Explanation:
#include <cstring>
#include <cstdio>
#include <string>
#include <array>
#include <random>
#include <algorithm>
struct RandomGenerator {
RandomGenerator(const size_t min, const size_t max) : dist(min, max) {}
std::random_device rd;
std::uniform_int_distribution<size_t> dist;
unsigned operator()() { return dist(rd); }
};
struct Gallow {
void Draw() const
{
std::printf(" ________\n"
"| |\n"
"| %c %c\n"
"| %c%c%c\n"
"| %c %c\n"
"|\n"
"|\n", body[0], body[1], body[2], body[3],
body[4], body[5], body[6]);
}
bool Increment()
{
switch (++errors) {
case 6: body[6] = '\\'; break;
case 5: body[5] = '/'; break;
case 4: body[4] = '\\'; break;
case 3: body[3] = '|'; break;
case 2: body[2] = '/'; break;
case 1: body[0] = '(', body[1] = ')'; break;
}
return errors < 6;
}
char body[7] { '\0' };
int errors { 0 };
};
struct Game {
void Draw() const
{
#ifdef _WIN32
std::system("cls");
#else
std::system("clear");
#endif
gallow.Draw();
std::for_each(guess.begin(), guess.end(), [](const char c) { std::printf("%c ", c); });
std::putchar('\n');
}
bool Update()
{
std::printf("Enter a letter: ");
const char letter = std::tolower(std::getchar());
while (std::getchar() != '\n') {}
bool found = false;
for (size_t i = 0; i < word.size(); ++i) {
if (word[i] == letter) {
guess[i] = letter;
found = true;
}
}
const auto end_game = [this](const char* msg) {
Draw();
std::puts(msg);
return false;
};
if (not found and not gallow.Increment())
return end_game("#### you lose! ####");
else if (found and word == guess)
return end_game("#### you win! ####");
return true;
}
RandomGenerator rand_gen { 0, words.size() - 1 };
const std::string word { words[rand_gen()] };
std::string guess { std::string().insert(0, word.size(), '_') };
Gallow gallow;
static const std::array<const std::string, 3> words;
};
const std::array<const std::string, 3> Game::words{{"control", "television", "computer"}};
int main()
{
Game game;
do {
game.Draw();
} while (game.Update());
return EXIT_SUCCESS;
}
Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reorder the elements of a given array. The CS111Sort algorithm is an algorithm that combines the SelectionSort and the InsertionSort following the steps below: 1. Implement the SelectionSort Algorithm on the entire array for as many iterations as it takes to sort the array only to the point of ordering the elements so that the last n/2 elements are sorted in increasing (ascending) order. 2. Implement the InsertionSort Algorithm to sort the first half of the resulting array elements so that these elements are sorted in decreasing (descending) order.
Answer:
class Main {
public static void main(String[] args) {
char arr[] = {'T','E','D','R','W','B','S','V','A'};
int n = arr.length;
System.out.println("Selection Sort:");
System.out.println("Iteration\tArray\tComparisons");
long comp1 = selectionSort(arr);
System.out.println("Total comparisons: "+comp1);
System.out.println("\nInsertion Sort:");
System.out.println("Iteration\tArray\tComparisons");
long comp2 = insertionSort(arr);
System.out.println("Total Comparisons: "+comp2);
System.out.println("\nOverall Total Comparisons: "+(comp1+comp2));
}
static long selectionSort(char arr[]) {
// applies selection sort for n/2 elements
// returns number of comparisons
int n = arr.length;
long comparisons = 0;
// One by one move boundary of unsorted subarray
for (int i = n-1; i>=n-n/2; i--) {
// Find the minimum element in unsorted array
int max_idx = i;
for (int j = i-1; j>=0; j--) {
// there is a comparison everytime this loop returns
comparisons++;
if (arr[j] > arr[max_idx])
max_idx = j;
}
// Swap the found minimum element with the first
// element
char temp = arr[max_idx];
arr[max_idx] = arr[i];
arr[i] = temp;
System.out.print(n-1-i+"\t");
printArray(arr);
System.out.println("\t"+comparisons);
}
return comparisons;
}
static long insertionSort(char arr[]) {
// applies insertion sort for n/2 elements
// returns number of comparisons
int n = arr.length;
n = n-n/2; // sort only the first n/2 elements
long comparisons = 0;
for (int i = 1; i < n; ++i) {
char key = arr[i];
int j = i - 1;
/* Move elements of arr[0..i-1], that are
greater than key, to one position ahead
of their current position */
while (j >= 0) {
// there is a comparison everytime this loop runs
comparisons++;
if (arr[j] > key) {
arr[j + 1] = arr[j];
} else {
break;
}
j--;
}
arr[j + 1] = key;
System.out.print(i-1+"\t");
printArray(arr);
System.out.println("\t"+comparisons);
}
return comparisons;
}
static void printArray(char arr[]) {
for (int i=0; i<arr.length; i++)
System.out.print(arr[i]+" ");
}
}
Explanation:
Explanation is in the answer.
Design an application for Bob's E-Z Loans. The application accepts a client's loan amount and monthly payment amount. Output the customer's loan balance each month until the loan is paid off. b. Modify the Bob's E-Z Loans application so that after the payment is made each month, a finance charge of 1 percent is added to the balance.
Answer:
part (a).
The program in cpp is given below.
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
//variables to hold balance and monthly payment amounts
double balance;
double payment;
//user enters balance and monthly payment amounts
std::cout << "Welcome to Bob's E-Z Loans application!" << std::endl;
std::cout << "Enter the balance amount: ";
cin>>balance;
std::cout << "Enter the monthly payment: ";
cin>>payment;
std::cout << "Loan balance: " <<" "<< "Monthly payment: "<< std::endl;
//balance amount and monthly payment computed
while(balance>0)
{
if(balance<payment)
{ payment = balance;}
else
{
std::cout << balance <<"\t\t\t"<< payment << std::endl;
balance = balance - payment;
}
}
return 0;
}
part (b).
The modified program from part (a), is given below.
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
//variables to hold balance and monthly payment amounts
double balance;
double payment;
double charge=0.01;
//user enters balance and monthly payment amounts
std::cout << "Welcome to Bob's E-Z Loans application!" << std::endl;
std::cout << "Enter the balance amount: ";
cin>>balance;
std::cout << "Enter the monthly payment: ";
cin>>payment;
balance = balance +( balance*charge );
std::cout << "Loan balance with 1% finance charge: " <<" "<< "Monthly payment: "<< std::endl;
//balance amount and monthly payment computed
while(balance>payment)
{
std::cout << balance <<"\t\t\t\t\t"<< payment << std::endl;
balance = balance +( balance*charge );
balance = balance - payment;
}
if(balance<payment)
{ payment = balance;}
std::cout << balance <<"\t\t\t\t\t"<< payment << std::endl;
return 0;
}
Explanation:
1. The variables to hold the loan balance and the monthly payment are declared as double.
2. The program asks the user to enter the loan balance and monthly payment respectively which are stored in the declared variables.
3. Inside a while loop, the loan balance and monthly payment for each month is computed with and without finance charges in part (a) and part (b) respectively.
4. The computed values are displayed for each month till the loan balance becomes zero.
5. The output for both part (a) and part (b) are attached as images.
The Monte Carlo (MC) Method (Monte Carlo Simulation) was first published in 1949 by Nicholas Metropolis and Stanislaw Ulam in the work "The Monte Carlo Method" in the Journal of American Statistics Association. The name Monte Carlo has its origins in the fact that Ulam had an uncle who regularly gambled at the Monte Carlo casino in Monaco. In fact, way before 1949 the method had already been extensively used as a secret project of the U.S. Defense Department during the so-called "Manhattan Project". The basic principle of the Monte Carlo Method is to implement on a computer the Strong Law of Large Numbers (SLLN) (see also Lecture 9). The Monte Carlo Method is also typically used as a probabilistic method to numerically compute an approximation of a quantity that is very hard or even impossible to compute exactly like, e.g., integrals (in particular, integrals in very high dimensions!). The goal of Problem 2 is to write a Python code to estimate the irrational number
Answer:
can you give more detail
Explanation:
g Q 2 Suppose I need a data structure having the following characteristics: a) must be very space efficient, and b) I have a good idea of how much total data needs to be stored. b) must have fastest access possible, and c) once I add an item to the data structure, I do not remove it. Part 1: What data structure would I choose and why? (2,4) Part 2: If I remove characteristic b, what similar data structure is a possible candidate?
Explanation:
a.I would choose an advanced data structure like dispersion tables.
Scatter tables, better known as hash tables, are one of the most frequently used data structures. To get an initial idea, scatter tables make it possible to have a structure that relates a key to a value, such as a dictionary. Internally, the scatter tables are an array. Each of the array positions can contain none, one or more dictionary entries.
It will normally contain a maximum of one, which allows quick access to the elements, avoiding a search in most cases. To know at which position in the array to search or insert a key, a scatter function is used. A scatter function relates each key to an integer value. Two equal keys must have the same dispersion value, also called a hash value, but two different keys can have the same dispersion value, which would cause a collision.
B. If I eliminated the characteristic b, a possible candidate keeping the previous characteristics would be: Balanced binary trees
Balanced binary trees are data structures that store key-data pairs, in an orderly way according to the keys, and allow quick access to the data, given a particular key, and to go through all the elements in order.
They are appropriate for large amounts of information and have less overhead than a scatter table, although the access time is of greater computational complexity.
Although the storage form has a tree structure internally, this is not externalized in the API, making the handling of the data transparent. They are called balanced because, each time they are modified, the branches are rebalanced in such a way that the height of the tree is as low as possible, thus shortening the average time of access to the data.
For this problem, you will write a function standard_deviation that takes a list whose elements are numbers (they may be floats or ints), and returns their standard deviation, a single number. You may call the variance method defined above (which makes this problem easy), and you may use sqrt from the math library, which we have already imported for you. Passing an empty list to standard_deviation should result in a ZeroDivisionError exception being raised, although you should not have to explicitly raise it yourself.
Answer:
import math def standard_deviation(aList): sum = 0 for x in aList: sum += x mean = sum / float(len(aList)) sumDe = 0 for x in aList: sumDe += (x - mean) * (x - mean) variance = sumDe / float(len(aList)) SD = math.sqrt(variance) return SD print(standard_deviation([3,6, 7, 9, 12, 17]))Explanation:
The solution code is written in Python 3.
Firstly, we need to import math module (Line 1).
Next, create a function standard_deviation that takes one input parameter, which is a list (Line 3). In the function, calculate the mean for the value in the input list (Line 4-8). Next, use the mean to calculate the variance (Line 10-15). Next, use sqrt method from math module to get the square root of variance and this will result in standard deviation (Line 16). At last, return the standard deviation (Line 18).
We can test the function using a sample list (Line 20) and we shall get 4.509249752822894
If we pass an empty list, a ZeroDivisionError exception will be raised.
Any set of logic-gate types that can realize any logic function is called a complete set of logic gates. For example, 2-input AND gates, 2- input OR gates, and inverters are a complete set, because any logic function can be expressed as a sum of products of variables and their complements, and AND and OR gates with any number of inputs can be made from 2-input gates. Do 2-input NAND gates form a complete set of logic gates? Prove your answer.
Answer:
Explanation:
We can use the following method to solve the given problem.
The two input NAND gate logic expression is Y=(A*B)'
we can be able to make us of this function by using complete set AND, OR and NOT
we take one AND gate and one NOT gate
we are going to put the inputs to the AND gate it will give us the output = A*B
we collect the output from the AND and we put this as the input to the NOT gate
then we will get the output as = (A*B)' which is needed
Which statement is LEAST accurate? Select one: a. A common reason for ERP failure is that the ERP does not support one or more important business processes of the organization b. Implementing an ERP system has as much to do with changing the way an organization does business than it does with technology. c. The big-bang approach to ERP implementation is generally riskier than the phased in approach. d. To take full advantage of the ERP process, reengineering will need to occur.
Answer:
d. To take full advantage of the ERP process, re-engineering will need to occur.
Explanation:
Justification:
ERP Implementation: ERP gives a change in technological ways for managing resources, the way to run the business is remained same but now Ft becomes well planned Diversified P units of Mich do not share common process. and data, generally employ phased-in approach of implementing ERP
• It is the way to overcome from the risk which is with the big bang approach, direct switching
• Perfect implementation of ERP needs re-engineering on the basis of performance
a. maintenance Sometimes ERP which is installed could not support one of the business process. due to lack of research before selecting it
• The statement that the diversified organizations. not. implement ERPs is least accurate because they implement it by employing phased-in approach Therefore, the correct option is d
6 things you should consider when planning a PowerPoint Presentation.
Answer: I would suggest you consider your audience and how you can connect to them. Is your presentation, well, presentable? Is whatever you're presenting reliable and true? Also, no more than 6 lines on each slide. Use colors that contrast and compliment. Images, use images. That pulls whoever you are presenting to more into your presentation.
Explanation:
Kitchen Gadgets sells a line of high-quality kitchen utensils and gadgets. When customers place orders on the company’s Web site or through electronic data interchange (EDI), the system checks to see if the items are in stock, issues a status message to the customer, and generates a shipping order to the warehouse, which fills the order. When the order is shipped, the customer is billed. The system also produces various reports.
1. List four elements used in DFDs, draw the symbols, and explain how they are used.
2. Draw a context diagram for the order system.
3. Draw a diagram 0 DFD for the order system.
4. Explain the importance of leveling and balancing. Your boss, the IT director, wants you to explain FDDs, BPM, DFDs, and UML to a group of company managers and users who will serve on a systems development team for the new marketing system.
Answer:
Ahhhhh suckkkkkkkkkkk
Create a program that generates a report that displays a list of students, classes they are enrolled in and the professor who teaches that class. There are 3 files that provide the input data: 1. FinalRoster.txt : List of students and professors ( S: student, P: professor) Student row: S,Student Name, StudentID Professor row: P, Professor Name, Professor ID, Highest Education 2. FinalClassList.txt: List of classes and professor who teach them (ClassID, ClassName, ID of Professor who teach that class) 3. FinalStudentClassList.txt: List of classes the students are enrolled in. (StudentID, ClassID) The output shall be displayed on screen and stored in a file in the format described in FinalOutput.txt You will need to apply all course concepts in your solution. 1. Student and Professor should be derived from a super class "Person" 2. Every class should implement toString method to return data in the format required for output 3. Exception handling (e.g. FileNotFound etc.) must be implemented 4. Source code must be documented in JavaDoc format 5. Do not hard code number of students, professors or classes. Submit source Java files, the output file and screenshot of the output in a zip format
Answer:
All the classes are mentioned with code and screenshots. . That class is shown at last.
Explanation:
Solution
Class.Java:
Code
**
* atauthor your_name
* This class denotes Class at the college.
*
*/
public class Class {
private String className,classID;
private Professor professor;
/**
* atparam className
* atparam classID
* atparam professor
*/
public Class(String className, String classID, Professor professor) {
this.classID=classID;
this.className=className;
this.professor=professor;
}
/**
* at return classID of the class
*/
public String getClassID() {
return classID;
}
/**
* Override toString() from Object Class
*/
public String toString() {
return classID+" "+className+" "+professor.getName()+" "+professor.getEducation();
}
}
Person.Java:
Code:
/**
* atauthor your_name
* This class represents Person
*
*/
public class Person {
protected String name;
/**method to fetch name
* at return
*/
public String getName() {
return name;
}
/**method to set name
* at param name
*/
public void setName(String name) {
this.name = name;
}
Professor.java:
Code:
import java.util.ArrayList;
import java.util.List;
/**
* at author your_name
*
*This class represents professors
*
*/
public class Professor extends Person{
private String professorID, education;
private List<Class> classes=new ArrayList<Class>();
/**
* at param name
* at param professorID
* at param education
*/
public Professor(String name,String professorID,String education) {
this.name=name;
this.professorID=professorID;
this.education=education;
}
/**
* at return
*/
public String getEducation() {
return this.education;
}
/**
* at return
*/
public String getprofessorID() {
return this.professorID;
}
/** to add classes
* at param Class
*/
public void addClass(Class c) {
classes.add(c);
}
/**
* Override toString() from Object Class
*/
public String toString() {
String result=this.getName()+" - "+professorID+" - "+education;
for(Class c:classes) {
result+=c.toString()+"\n";
}
return result;
}
}
}
Student.java:
Code:
import java.util.ArrayList;
import java.util.List;
/**
* This class represents students
* at author your_Name
*
*/
public class Student extends Person{
private String studentID;
private List<Class> classes=new ArrayList<Class>();
/**
* atparam name
* atparam studentID
*/
public Student(String name,String studentID) {
this.name=name;
this.studentID=studentID;
}
/**
* atreturn
*/
public String getStudentID() {
return studentID;
}
/**
* atparam c
*/
public void addClass(Class c) {
classes.add(c);
}
/**
* atreturn
*/
public int getClassCount() {
return classes.size();
}
/**
* Override toString() from Object Class
*/
public String toString() {
String result=this.getName()+" - "+studentID+"\n";
for(Class c:classes) {
result+=c.toString()+"\n";
}
return result;
}
}
NOTE: Kindly find an attached copy of screenshot of the output, which is a part of the solution to this question
Describe the Software Development Life Cycle. Describe for each phase of the SDLC how it can be used to create software for an Employee Payroll System that allows employees to log the number of hours completed in a work period and then generate their pay. Use Microsoft Word to complete this part of the assessment. Save your file as LASTNAME FIRSTNAME M08FINAL1 were LASTNAME is your lastname and FIRSTNAME is your first name. Upload your answer to this question; do not submit this assessment until you have completed all questions. This question is worth 25 points.
Answer:
Check the explanation
Explanation:
SDLC
SDLC stands for Software Development Life Cycle
It provides steps for developing a software product
It also checks for the quality and correctness of a software
The main aim of SDLC is to develop a software, which meets a customer requirements
SDLC involves various phases to develop a high-quality product for its end user
Phases of SDLC
There are seven phases in a software development life cycle as follows,
Requirement Analysis Feasibility Study Design Coding Testing Deployment Maintenance
kindly check the attached image below
Requirement analysis
This is the first stage in a SDLC.
In this phase, a detailed and precise requirements are collected from various teams by senior team members
It gives a clear idea of the entire project scope, opportunities and upcoming issues in a project
This phase also involves, planning assurance requirements and analyze risk involved in the project
Here, the timeline to finish the project is finalized
Feasibility Study
In this stage, the SRS document, that is “Software Requirement Specification” document is defined, which includes everything to be designed and developed during the life cycle of a project
Design
In this phase as the name indicates, software and system design documents are prepared, based on the requirement specification document
This enable us to define the whole system architecture
Two types of design documents are prepared in this phase as follows,
High-Level Design
Low-Level Design
Coding
In this phase, the coding of project is done in a selected programming language
Tasks are divided into many units and given to various developers
It is the longest phase in the SDLC
Testing
In this stage, the developed coding is tested by the testing team
The testing team, checks the coding in the user point of view
Installation/Deployment
In this stage, a product is released by the company to the client
Maintenance
Once the product is delivered to the client, the maintenance phase work will start by fixing errors, modifying and enhancing the product.
Employee Payroll System
Requirement analysis
Gather information from various team for requirement
Analyze the number of employees to handle the project
Timeline to finish the project, eg.1 month
Feasibility Study
The system requirements such as how many systems are required
Decide which software to be installed to handle the project.
For example, if we are going to develop the software using C language, then software for that has to be installed
The SRS document has to be prepared
Design
In this the HLD and LLD is prepared, the overall software architecture is prepared
The modules involved in coding are decided
Here the modules can be employee, payroll manager, Employee Log time, account details
The input and output are designed, such as employee name is the input and output is the salary for him, based on working hours
Coding
Here the coding is divided into various sections and given to 2 or more employees
One may code employee detail, one will code working hours of employees and one may code the banking details of employee
Testing
The coding is tested for syntax, declaration, data types and various kinds of error
The testing team will test the coding with various possible values
They may even check with wrong values and analyze the output for that
Installation
Now the software is installed in the client system and the client is calculating the payroll for an employee based on working hours in a month
Maintenance
If any error occurs, the team will clear the issue.
When a new employee joins, then the employee data will added to the database and the database is updated
Also if the client asks for any new features, it will done in this phase.
A university wants to schedule the classrooms for final exams. The attributes are given below:
course : course id, name, and department
section : section id, enrollment, and dependent as a weak entity set on course
room : room number, capacity, and building
exam: course id, section id, room number, and time.
1) Determine the relationships among these entity sets. Clearly specify the arity, the attributes, and the mapping cardinality of these relationships.
2) Construct an E-R diagram to for the scheduling system.
Answer:
See explaination
Explanation:
Clearly the entities are as follows:-
Course
Section
Room
Test
The relationship among entities are as follows:-
Course has Section
Test is conducted for Course
Test is conducted in Section
Test is conducted in Room
Attributes of each entities are as follows:-
Course (CourseID, Name, Department)
Section (SectionID, Enrollment)
Room (RoomNumber, Capacity, Building)
Test (Time)
Section is a week entity as, there may be same sections for different courses, therefore section uses the primary key of course entity as foreign key.
Also entity Test is dependent upon the entities Room,Section and Course, therefore primary keys of these entities will be used as foreign key in the Test entity.
Check attachment for the ER diagram
1. Write a pair of classes, Square1 and Rectangle1. Define Square1 as a subclass of Rectangle1. In addition to setters and getters, provide such methods as computeArea and computePerimeter. Specify the preconditions, postconditions and class invariants, if any, as comments (
Answer:
The java program including classes is shown below.
import java.util.*;
import java.lang.*;
//base class
class Rectangle1
{
//variables to hold dimensions and area
static double l;
static double b;
static double a;
//setter
static void setWidth(double w)
{
b=w;
}
//getter
static double getWidth()
{
return b;
}
//setter
static void setLength(double h)
{
l=h;
}
//getter
static double getLength()
{
return b;
}
//area calculation for rectangle
static void computeArea()
{
a = getLength()*getWidth();
System.out.println("Area of rectangle = " +a);
}
}
//derived class
class Square1 extends Rectangle1
{
//variables to hold dimensions and perimeter
static double s;
static double peri;
//settter
static void setSide(double d)
{
s=d;
}
//getter
static double getSide()
{
return s;
}
//perimeter calculation for square
static void computePerimeter()
{
peri = 2*(getSide()+getSide());
System.out.println("Perimeter of square = "+peri);
}
}
public class MyClass {
public static void main(String args[]) {
//object of derived class created
Square1 ob = new Square1();
ob.setLength(1);
ob.setWidth(4);
ob.setSide(1);
ob.computeArea();
ob.computePerimeter();
}
}
Explanation:
1. The class for rectangle is defined having variables to hold the dimensions of a rectangle.
2. The getters and setters are included for both the dimensions.
3. The method to compute the area of the rectangle is defined.
4. The class for square is defined having variables to hold the side of a square.
5. The getter and setter are included for the dimension of the square.
6. The method to compute the perimeter of the square is defined.
7. The class Square1 is the derived class which inherits the class Rectangle1 through the keyword extends.
8. All the variables, getters, setters and methods are declared as static.
9. Another class is defined having only the main() method.
10. Inside main(), the object of the derived class, Square1, is created.
11. The setters and the methods are called through this object.
12. The value of the dimensions are passed as arguments to the setters.
13. The output is attached in an image.
Given the following header: vector split(string target, string delimiter); implement the function split so that it returns a vector of the strings in target that are separated by the string delimiter. For example: split("10,20,30", ",") should return a vector with the strings "10", "20", and "30". Similarly, split("do re mi fa so la ti do", " ") should return a vector with the strings "do", "re","mi", "fa", "so", "la", "ti", and "do". Write a program that inputs two strings and calls your function to split the first target string by the second delimiter string and prints the resulting vector all on line line with elements separated by commas. A successful program should be as below with variable inputs:
Answer:
see explaination
Explanation:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<string> split(string, string);
int main()
{
vector<string> splitedStr;
string data;
string delimiter;
cout << "Enter string to split:" << endl;
getline(cin,data);
cout << "Enter delimiter string:" << endl;
getline(cin,delimiter);
splitedStr = split(data,delimiter);
cout << "\n";
cout << "The substrings are: ";
for(int i = 0; i < splitedStr.size(); i++)
cout << "\"" << splitedStr[i] << "\"" << ",";
cout << endl << endl;
cin >> data;
return 0;
}
vector<string> split(string target, string delimiter)
{
unsigned first = 0;
unsigned last;
vector<string> subStr;
while((last = target.find(delimiter, first)) != string::npos)
{
subStr.push_back(target.substr(first, last-first));
first = last + delimiter.length();
}
subStr.push_back(target.substr(first));
return subStr;
}
Consider the following relations:
Emp(eid: integer, ename: varchar, sal: integer, age: integer, did: integer) Dept(did: integer, budget: integer, floor: integer, mgr_eid: integer) Salaries range from $10,000 to $100,000, ages vary from 20 to 80, each department has about five employees on average, there are 10 floors, and budgets vary from $10,000 to $1 million. You can assume uniform distributions of values. For each of the following queries, which of the listed index choices would you choose to speed up the query.
1. Query: Print ename, age, and sal for all employees.
A) Clustered hash index on fields of Emp.
B) Unclustered hash index on fields of Emp.
C) Clustered B+ tree index on fields of Emp.
D) Unclustered hash index on fields of Emp.
E) No index.
2. Query: Find the dids of departments that are on the 10th floor and have a budget of less than $15,000.
A) Clustered hash index on the floor field of Dept.
B) Unclustered hash index on the floor field of Dept.
C) Clustered B+ tree index on fields of Dept.
D) Clustered B+ tree index on the budget field of Dept.
E) No index.
Answer:
Check the explanation
Explanation:
--Query 1)
SELECT ename, sal, age
FROM Emp;
--Query 2)
SELECT did
FROM Dept
WHERE floot = 10 AND budget<15000;
Assuming theclassdefinitionaboveis fully implementedandgiventhefollowingmain() function, please indicate which function in the class definition is invoked for each line in main(). For example,line 2 of main invokes line 9 twice (the constructor)forthe matrix class and line 9 and 10 inmain() both invoke thematrix::transpose()function, orline20 inthe matrix class definition on the previous page. Fill outthe others similarly.
Answer:
Line 4 = 28 40
Line 5 = 28 40
Line 6 = 28 40
Line 8 = 28 40
Line 11 = None
Line 12 = 17 16
Line 13 = 18 16
Line 14 = 19 16
Line 15 = 9
Explanation:
Main line number || Matrix object line number (in order)
2 9, 9
3 9
4 28 40
5 28 40
6 28 40
7 None
8 28 40
9 20
10 20
11 None
12 17 16
13 18 16
14 19 16
15 9