Language: C++
Conduct an evaluation of the performance of STL containers (vector, list, set, unordered_set) in inserting and finding elements, with a relatively large data set. What you'll be measuring is the execution time. Obviously it's dependent on the speed of the computer one uses, so what matters is the relative speed (relative to the vector's speed in percentage)
In: Computer Science
Create a c++ program that:
(90 to 100 is an A, 80 to 89 is a B, 70 to 79 is a C, 60 to 69 is a D, 0 to 60 is a F)
In: Computer Science
Use Java
(Science: day of the week)
Zeller’s congruence is an algorithm developed by Christian Zeller
to calculate the day of the week.
The formula is :
h = (q + 26(m+1)/10 + k + k/4 + j/4 + 5j) % 7
where
- h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3:
Tuesday, 4: Wednesday, 5: Thursday, 6: Friday).
- q is the day of the month.
- m is the month (3: March, 4: April, ..., 12: December). January
and February are counted as months 13 and 14 of the previous
year.
- j is the century (i.e., year/100)
- k is the year of the century (i.e., year%100).
Note that the division in the formula performs an integer
division.
Write a program that prompts the user to enter a year, month, and
day of the month, and displays the name of the day of the
week.
Sample Run 1
Enter year: (e.g., 2012): 2015
Enter month: 1-12: 1
Enter the day of the month: 1-31: 25
Day of the week is Sunday
Sample Run 2
Enter year: (e.g., 2012): 2012
Enter month: 1-12: 5
Enter the day of the month: 1-31: 12
Day of the week is Saturday
Sample Run 3
Enter year: (e.g., 2012): 2002
Enter month: 1-12: 3
Enter the day of the month: 1-31: 26
Day of the week is Tuesday
Sample Run 4
Enter year: (e.g., 2012): 2008
Enter month: 1-12: 1
Enter the day of the month: 1-31: 1
Day of the week is Tuesday
Sample Run 5
Enter year: (e.g., 2012): 2000
Enter month: 1-12: 2
Enter the day of the month: 1-31: 12
Day of the week is Saturday
(Hint: January and February are counted as 13 and 14 in the
formula, so you need to convert the user input 1 to 13 and 2 to 14
for the month and change the year to the previous year.)
Class Name: Exercise03_21
If you get a logical or runtime error, please refer
https://liveexample.pearsoncmg.com/faq.html.
In: Computer Science
In: Computer Science
In: Computer Science
Write a python code to Design and implement a function with no input parameter which reads a number from input (like 123). Only non-decimal numbers are valid (floating points are not valid). The number entered by the user should not be divisible by 10 and if the user enters a number that is divisible by 10 (like 560), it is considered invalid and the application should keep asking until the user enters a valid input. Once the user enters a valid input, the program calculates the reverse of the input number (for 153, the reverse is 351) and prints the result and returns the results.Do not use try and except. Use Main function.
In: Computer Science
Question 4
A connection between two or more computers on the same network connected via a cable and two computers in different parts of the world differs. Identify explain how the two connections types differ. Suppose that you are required to create a document to explain the different sections of DTE and DCE, by indicating the purpose of NIU and NID. Where would a wireless base station connect to a cellular network?
In: Computer Science
Write a C++ program in a file called pop.cpp that opens a file called pop.dat which has the following data (you’ll have to create pop.dat)
AX013 1.0
BX123456 1234.56
ABNB9876152345 99999.99
The data are account numbers and balances. Account numbers are, at most 14 characters. Balances are, at most, 8 characters (no more than 99999.99). Using a loop until the end of file, read an account number and balance then write these to standard output in the following format shown below. Use the I/O manipulators setw, left, and right. Set the precision/fixed/showpoint so that all numeric data is written are written with exactly two digits to the right of the decimal.
Account Number Balance
-------------------------
AX013 $ 1.00
BX123456 $ 1234.56
ABNB9876152345 $ 99999.99
In: Computer Science
Use Java
(Find the number of days in a month)
Write a program that prompts the user to enter the month and year
and displays the number of days in the month.
For example,
If the user entered month 2 and year 2012, the program should
display that February 2012 has 29 days.
If the user entered month 3 and year 2015, the program should
display that March 2015 has 31 days.
Sample Run 1
Enter a month in the year (e.g., 1 for Jan): 2
Enter a year: 2012
February 2012 has 29 days
Sample Run 2
Enter a month in the year (e.g., 1 for Jan): 4
Enter a year: 2005
April 2005 has 30 days
Sample Run 3
Enter a month in the year (e.g., 1 for Jan): 2
Enter a year: 2006
February 2006 has 28 days
Sample Run 4
Enter a month in the year (e.g., 1 for Jan): 2
Enter a year: 2000
February 2000 has 29 days
Class Name: Exercise03_11
If you get a logical or runtime error, please refer
https://liveexample.pearsoncmg.com/faq.html.
In: Computer Science
Match the following
column A column B
Comment. 1. java.util.Scanner
Wrapper 2. length
char[] myletters 3. final int x=10;
import java.io.* 4. catch
ArrayList 5.alpha
String Class 6.double
Switch 7.inputfile.close();
try 8.remove()
Constant 9.default
Keyboard Input 10.compare
In: Computer Science
Why QoS in mobile networks should be considered on an end to end basis? and how does jitter affect QoS in mobile networks?
In: Computer Science
Given two arrays: A[0..m-1] and B[0..n-1]. Find whether B[] is a subset of A[] or not. Both the arrays are not in sorted order. It may be assumed that elements in both array are distinct. Design an O(n) time algorithm that solves this problem. Provide pseudocode
Ex:
Input: A[] = {11, 1, 13, 21, 3, 7}, B[] = {11, 3, 7, 1}
Output: B[] is a subset of A[]
Input: A[] = {1, 2, 3, 4, 5, 6}, B[] =
{1, 2, 4}
Output: B[] is a subset of A[]
Input: A[] = {10, 5, 2, 23, 19}, B[] =
{19, 5, 3}
Output: B[] is not a subset of A[]
In: Computer Science
Language: Java
Crust :
A small pizza costs $5.99, a medium is $7.99, and a large is $9.99.
A handtossed crust is an additional $0.50, and a deep dish pan crust is an additional $1.00.
Do a CrustSize enum [S(5.99), M(7.99), and L(9.99)] and a CrustType enum [THIN(0.00), HAND(0.50), and PAN(1.00)].
Place your enums in CrustEnum.java.
Both enums should have cost methods.
Do a Crust class with a constructor that accepts and sets the crust size and type, and provide a crustCost method.
Do a toString method to report the state of the crust.
Write getCrust (returns "THIN", "HAND", or "PAN") and getSize (returns a char 'S', 'M', or 'L').
I have most of it already, I just need help with the Crust class, aka the crustCost, toString, and getCrust.
There is a toString method, though I dont know if its right, as well as a crustCost.
If you need to delete something because it is wrong, feel free.
CrustEnum.java:
public enum CrustSize{
S(5.99),
M(7.99),
L(9.99);
private double cost;
private CrustSize(double cost){
this.cost = cost;
}
public double getCost(){
return this.cost;
}
public enum CrustType{
THIN(0.00),
HAND(0.50),
PAN(1.00);
private double cost;
CrustType(double cost){
this.cost = cost;
}
public double getCost(){
return this.cost;
}
}
private CrustSize size;
private CrustType type;
public CrustEnum(String size, String type){
this.size = CrustSize.valueOf(size);
this.type = CrustType.valueOf(type);
}
public double CrustCost(){
return (size.getCost() + type.getCost());
}
}
public class Crust {
private CrustEnum crust;
public Crust(String size, String type){
this.crust = new
CrustEnum(size,type);
}
public String toString(){
return "The crust is a " +
this.size + " " + this.type + " pizza";
public double crustCost(){
return crust.crustCost();
}
}
In: Computer Science
Use Java
(Algebra: solve 2 x 2 linear equations)
A linear equation can be solved using Cramer’s rule given in
Programming Exercise 1.13.
Write a program that prompts the user to enter a, b, c, d, e, and f
and displays the result.
If ad - bc is 0, report The equation has no solution.
Sample Run 1
Enter a, b, c, d, e, f: 9.0 4.0 3.0 -5.0 -6.0 -21.0
x is -2.0 and y is 3.0
Sample Run 2
Enter a, b, c, d, e, f: 1.0 2.0 2.0 4.0 4.0 5.0
The equation has no solution
Sample Run 3
Enter a, b, c, d, e, f: 1.0 2.0 2.0 4.0 4.0 5.0 6.0
x is -4.0 and y is 4.5
Class Name: Exercise03_03
If you get a logical or runtime error, please refer
https://liveexample.pearsoncmg.com/faq.html.
In: Computer Science
Consider distributing a file of F = X Gbits to N = 20 peers. The server has an upload rate of us = X*3 Mbps, and each peer has a download rate of di = X/2 Mbps and an upload rate of X/10.
The numeric value X is the position of the first letter of your last name in the alphabet. For example if your last name starts with A then X = 1 and F = 1 Gbits.
Find the distribution time for
1. Client-server distribution
2. Peer-to-peer distribution
In: Computer Science