Under Unix C-shell environment, you can create variables using either set or setenv. What is the difference between these two types of variables?
Does Python have array type? Why or why not? Give some reasoning.
Create a class for watch with at least two method
Create two subclasses for mechanical watch and solar watch. Create at least two methods for each subclass.
Write regular expression to match scientific notation numbers. Your regular expression coefficient can be either integer or float.
1)
All variables set with setenv command are automatically exported to subshell. All csh variables set to with set command are NOT automatically exported to subshell. In this example, set an enviorment variable called vech using set command:
set vech=bus echo "$vech" |
Start a new shell
csh
Try to display $vech, enter:
echo "$vech" |
Sample outputs:
vech: Undefined variable.
Now, try same with setenv command:
setenv jaildir /nas/httpd echo "$jaildir" csh echo "$jaildir" |
Sample outputs:
/nas/httpd
In short, set command is used for this shell and setenv for this and any subshells. Usually, all system environmental variable such as $HOME, $USER, $MAIL, $PATH, and others are defined using setenv command.
2) Python does not have array type.
Because Python is a dynamically-typed language. Arrays imply some sort of type (array of int, array of float, etc.).
Python has the list type, which is heterogeneous:
It’s somewhat like an array, but as you can see, you need not fill it with objects of the same type (although it’s typically used to hold objects of a single type).
If you want to enforce typing, there is an array type which can be imported:
In addition, if you are doing statistics, Data Science, or a field where you need true numerics, you can use the numpy package, which has an array type:
3) NOTE: Since you have not mentioned the language, I am providing the code in Java.
CODE
class Watch {
private String model;
private double price;
public Watch(String model, double price) {
super();
this.model = model;
this.price = price;
}
/**
* @return the model
*/
public String getModel() {
return model;
}
/**
* @param model the model to set
*/
public void setModel(String model) {
this.model = model;
}
/**
* @return the price
*/
public double getPrice() {
return price;
}
/**
* @param price the price to set
*/
public void setPrice(double price) {
this.price = price;
}
}
NOTE: As per Chegg policy, I am allowed to answer only 3 questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.
Under Unix C-shell environment, you can create variables using either set or setenv. What is the...
You will create a shell script that prints out the following information about the system it is run on: • The system’s name and IP address • How much memory the system is currently using, and how much total memory it has • The number of CPUs of the machine • The number of unique users on the system at that moment When your script is run, each of these values should be clearly labeled in the output, such as...
You will create a shell script that prints out the following information about the system it is run on: • The system’s name and IP address • How much memory the system is currently using, and how much total memory it has • The number of CPUs of the machine • The number of unique users on the system at that moment When your script is run, each of these values should be clearly labeled in the output, such as...
Using loops with the String and Character classes. You can also use the StringBuilder class to concatenate all the error messages. Floating point literals can be expressed as digits with one decimal point or using scientific notation. 1 The only valid characters are digits (0 through 9) At most one decimal point. At most one occurrence of the letter 'E' At most two positive or negative signs. examples of valid expressions: 3.14159 -2.54 2.453E3 I 66.3E-5 Write a class definition...
Assignment 2 In this assignment, you will write two short programs to solve problems using recursion. 1. Initial Setup Log in to Unix. Run the setup script for Assignment 2 by typing: setup 2 2. Towers of Hanoi Legend has it that in a temple in the Far East, priests are attempting to move a stack of disks from one peg to another. The initial stack had 64 disks threaded onto one peg and arranged from bottom to top by...
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
Part 1. [30 points] In this part, your program
loads a vending machine serving cold drinks. You start with many
foods, some are drinks. Your code loads a vending machine from
foods, or, it uses water as a default drink. Create class Drink,
make an array of drinks, load it and display it.
Part 1 steps:
[5 points] Create a class called
Drink that contains information about a single
drink. Provide...
10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...