Time Calculator – Intro To Programming - JAVA Write a program that asks the user to enter a number of seconds.
• There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds.
• There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours in that many seconds.
• There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of days in that many seconds.
The .JAVA file from your program should be attached to this assignment.
In: Computer Science
C++
Task 1
Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the sorted list of scores and averages with appropriate headings.
Input Validation: Do not accept negative numbers for test scores.
Task 2
Modify the program so the lowest test score is dropped. This score should not be included in the calculation of the average.
Task 3
Modify the program to allow the user to enter name-score pairs. For each student taking a test, the user types the student’s name followed by the student’s integer test score. Modify the sorting function so it takes an array holding the student names and an array holding the student test scores. When the sorted list of scores is displayed, each student’s name should be displayed along with his or her score.
C++
In: Computer Science
In MIPS assembly language, write a function that will display the max and min value in an array. Then write a function to calculate and display the average of all values in an array. This must be done in MIPS assembly language.
In: Computer Science
<<<<<<<<. I need the UML diagram for all classes.java below. >>>>>
// Vehicle.java
public class Vehicle {
// data members declared as private
private String make;
private double weight;
private double height;
private double length;
private int maxSpeed;
private int noOfDoors;
private int numberSeats;
/**
* @param make
* @param weight
* @param height
* @param length
* @param maxSpeed
* @param noOfDoors
* @param maxPassengers
* @param numberSeats
*/
public Vehicle(String make, double weight, double
height, double length,
int maxSpeed,
int noOfDoors, int numberSeats) {
this.make = make;
this.weight = weight;
this.height = height;
this.length = length;
this.maxSpeed = maxSpeed;
this.noOfDoors = noOfDoors;
this.numberSeats = numberSeats;
}
/**
* @return the make
*/
public String getMake() {
return make;
}
/**
* @param make
* the make to set
*/
public void setMake(String make) {
this.make = make;
}
/**
* @return the weight
*/
public double getWeight() {
return weight;
}
/**
* @param weight
* the weight to set
*/
public void setWeight(double weight) {
this.weight = weight;
}
/**
* @return the height
*/
public double getHeight() {
return height;
}
/**
* @param height
* the height to set
*/
public void setHeight(double height) {
this.height = height;
}
/**
* @return the length
*/
public double getLength() {
return length;
}
/**
* @param length
* the length to set
*/
public void setLength(double length) {
this.length = length;
}
/**
* @return the maxSpeed
*/
public int getMaxSpeed() {
return maxSpeed;
}
/**
* @param maxSpeed
* the maxSpeed to set
*/
public void setMaxSpeed(int maxSpeed) {
this.maxSpeed = maxSpeed;
}
/**
* @return the noOfDoors
*/
public int getNoOfDoors() {
return noOfDoors;
}
/**
* @param noOfDoors
* the noOfDoors to set
*/
public void setNoOfDoors(int noOfDoors) {
this.noOfDoors = noOfDoors;
}
/**
* @return the numberSeats
*/
public int getNumberSeats() {
return numberSeats;
}
/**
* @param numberSeats
* the numberSeats to set
*/
public void setNumberSeats(int numberSeats) {
this.numberSeats =
numberSeats;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Make=" + make + ", weight="
+ weight + ", height=" + height
+ ", length=" + length + ", maxSpeed=" +
maxSpeed
+ ", noOfDoors=" + noOfDoors + ", Number of
Seats ="
+ numberSeats;
}
}
==========================================
// Car.java
public class Car extends Vehicle {
private int maxPassengers;
private boolean isConvertable;
public Car(String make, double weight,
double height, double length,
int maxSpeed, int noOfDoors, int maxPassengers,
int numberSeats,
boolean
isConvertable) {
super(make, weight, height,
length, maxSpeed, noOfDoors, numberSeats);
this.maxPassengers =
maxPassengers;
}
/**
* @return the
maxPassengers
*/
public int getMaxPassengers() {
return
maxPassengers;
}
/**
* @param
maxPassengers
* the maxPassengers to set
*/
public void setMaxPassengers(int
maxPassengers) {
this.maxPassengers =
maxPassengers;
}
/**
* @return the
isConvertable
*/
public boolean isConvertable()
{
return
isConvertable;
}
/**
* @param
isConvertable
* the isConvertable to set
*/
public void setConvertable(boolean
isConvertable) {
this.isConvertable =
isConvertable;
}
/*
* (non-Javadoc)
*
* @see
java.lang.Object#toString()
*/
@Override
public String toString() {
return "Car ::" +
super.toString() + ", MaxPassengers=" +
maxPassengers
+ ", isConvertable=" +
isConvertable;
}
}
==========================================
// Bus.java
public class Bus extends Vehicle
{
private int
numberAxles;
public Bus(String make, double weight,
double height, double length,
int maxSpeed, int noOfDoors, int numberSeats,
int numberAxles) {
super(make, weight, height,
length, maxSpeed, noOfDoors, numberSeats);
this.numberAxles =
numberAxles;
}
/**
* @return the
numberAxles
*/
public int getNumberAxles() {
return
numberAxles;
}
/**
* @param
numberAxles
* the numberAxles to set
*/
public void setNumberAxles(int numberAxles)
{
this.numberAxles =
numberAxles;
}
/*
* (non-Javadoc)
*
* @see
java.lang.Object#toString()
*/
@Override
public String toString() {
return "Bus ::" +
super.toString() + ", Number Axles=" + numberAxles;
}
}
In: Computer Science
Find the network address, the direct broadcast address, and the number of addresses in a block; if one of the addresses in this block is 175.120.240.17/19
In: Computer Science
I. Create the class Item with the following members:
1. id, a protected variable of type int
2. name, a protected variable of type string
3. price, a protected variable of type double
4. a public non-default constructor which accepts three parameters
to initialize the variables above
5. a copy constructor
6. overload the = operator such that both operands are of type
Item
7. overload the = operator such that the right operand is of type
double. Assign the value of double to the price member
In: Computer Science
Alameen is a railway system and wants to install Ticket Vending Machines (TVMs) on the platforms of all rail stations in Peshawar. The TVMs will allow the passenger to buy a ticket/pass using cash, coins, debit cards, or credit cards. The interface of the TVMs should be very easy for the passengers to buy their tickets.
This system should be designed in such a way that the passenger first selects the ticket type, transaction mode, and then get a pass/ticket. Passengers can be adult, senior/disabled citizens, child (5-14 years old), high school, or college students. Ticket type can be either a two-hour pass, midday pass, or AM pass (Monday through Friday from 09:30 am to 02:30 pm), a PM pass (noon through the end of service on the date purchased), a day pass, a 7-day pass, or a 31-day pass. There will be no ticket fare for senior or disabled citizens. The only thing they have to show during traveling is the valid ID and ticket. The ticket fare for a child (5-14 years old), high school or college students will be reduced, and they will have to show valid Id along with ticket (reduced fare) to the ticket checking authority.
The system should restrict the unauthorized users from using the system. The system should be fast enough that it should accept the input from the user in less than 1 second. The system should be fast enough to print the ticket to the user within 3 to 5 secs when user inserts all the required information. The system should be available 24 hours a day and 7 days a week. The system will also be used by the operator to know the cash and coins inside the machine and withdraw or deposit cash when required. The system is designed in such a way to allow admin to generate reports. The reports include how many tickets are sold, the number of transactions, cash or coins collected, change fares, cash, or coins dispensed.
Read the above-mentioned scenario and answer the following questions which are as follows:
In: Computer Science
In python.
Projectile motion: Write a python program that will ask the user for
an initial height y0, initial velocity v, launch angle theta, and mass m.
Create two functions, one that will calculate max height
of the projectile, and one that will calculate the range. Ask the
user which one he/she would like to calculate, then present them with
the answer. (use kg, m and m/s)
In: Computer Science
Give the mask in the dotted-decimal notation:
a. For a block of Class A which results in 32 subnets
b. Which combines 2048 Class C blocks into a supernet
c. For a block of Class B which results in 64 subnets
d. Which combines 16 Class B blocks into a supernet
In: Computer Science
[Javascript] Create a function(returnObjectFromId(case, ...idNum)) to return the case Object(s) for a given idNum, or list of idNums.
Calling with a single `idNum` value should return the case Object, and return NULL if an id value that's unknown is passed
returnObjectFromId(case, 84838) would return the Object in the cases Array with
an 'idNumber' of id, and use the .find() method of the cases Array to locate items by idNumber.
returnObjectFromId(cases, -23298312) would return null.
returnObjectFromId(cases, 161020, 161021) would return an Array of case Objects
with two elements, matching the id values. We don't add anything to the returned Array,
if any of the ids in the list are unknown.
As an example, the following function would return an Array of 2 case Objects, ignoring the unknown
id(-23298312):
returnObjectFromId(cases, 231321, 241249, -23298312) would return an Array of 2 cases.
example of case object:
case = {
"idNumber": 112319,
"Reported Date": "2020-08-15",
"Episode Date": "2020-07-12",
},
{
"idNumber": 132421,
"Reported Date": "2020-08-12",
"Episode Date": "2020-07-19",
},
...etc
In: Computer Science
Q1: According to the following table, which describe the grade distribution of students. Find the mean, median class, median, modal class and mode for this distribution.
1-Mean.
2-Median Class.
3-Median.
4-Modal Class.
5-Mode.
Frequency |
Grade |
2 |
51 - 55 |
7 |
56 - 60 |
8 |
61 - 65 |
4 |
66 - 70 |
In: Computer Science
1. What is meant by malware/viruses? What is their history? Are malware and/or viruses recent developments in computer technology or have they been around for a while? What piece of malware/virus are choosing to write about and why?
In: Computer Science
Please write python code for the following. Implement the functions defined below. Include a triple-quoted comments string at the bottom displaying your output. Using sets (described in Deitel chapter 6) will simplify your work.
Below is the starter template for the code:
def overlap(user1, user2, interests):
""" Return the number of interests that user1 and user2
have in common """
return 0
def most_similar(user, interests):
""" Determine the name of user who is most similar
to the input user defined by having the most interests
in common. Return a tuple: (most_similar_user,
num_interests_in_common) """
return ("", 0)
def recommendations(user, interests):
""" Find the user who shares the most interests with the specified
user.
Recommend to user any interests that his or her closest match
has
that are not already in the user's list of interests.
Return a list of recommendations. """
return []
#%% Don't change this:
interests = {
"Pam":["Hadoop", "Big Data", "HBase", "Java", "Spark", "Storm",
"Cassandra"],
"Ann":["NoSQL", "MongoDB", "Cassandra", "HBase", "Postgres"],
"Raj":["Python", "scikit-learn", "scipy", "numpy", "statsmodels",
"pandas"],
"Jim":["R", "Python", "statistics", "regression", "probability",
"programming languages"],
"Eve":["machine learning", "regression", "decision trees",
"libsvm"],
"Carl Yastrzemski":["Python", "R", "Java", "C++", "Haskell",
"programming languages"],
"Sam":["statistics", "probability", "mathematics", "theory"],
"Una":["machine learning", "scikit-learn", "Mahout", "neural
networks"],
"Liv":["neural networks", "deep learning", "Big Data", "artificial
intelligence"],
"Bob":["Hadoop", "Java", "MapReduce", "Big Data"],
"Jon":["statistics", "R", "statsmodels"],
"Tom":["pandas", "R", "Python"],
"Tim":["databases", "HBase", "Postgres", "MySQL", "MongoDB"],
"Hal":["libsvm", "regression", "support vector machines"],
"Joe":["C++", "deep learning", "artificial intelligence",
"probability"]
}
#%% Don't change this either!
for user in interests.keys():
print(user, recommendations(user, interests))
#%% Put output here
"""
Your output
"""
In: Computer Science
(C++)Order statistics: Write codes for Rand-Select (with linear expected running time) and Select (with linear worst-case running time). Test your two programs with an input array that is a random permutation of A = {1, 2, 3, …, 99, 100}
In: Computer Science
In: Computer Science