Questions
In JAVA : There are two text files with the following information stored in them: The...

In JAVA :

There are two text files with the following information stored in them:

The instructor.txt file where each line stores the id, name and affiliated department of an instructor separated by a comma The department.txt file where each line stores the name, location and budget of the department separated by a comma

You need to write a Java program that reads these text files and provides user with the following menu:

1. Enter the instructor ID and I will provide you with the name of the instructor, affiliated department and the location of that department.

2. Enter the department name and I will provide you with the location, budget and names of all instructors that work for the department.

3. Insert a record about a new instructor.

4. Exit

The above menu should continue to be displayed in a loop until the user selects option 4.

When the user selects option 1 above, the following should be displayed:

Enter the instructor ID:

If the user enters an instructor id that is not present in the text file, display "The ID doesnot appear in the database.", otherwise, display the name of the instructor, affiliated department and the location of that department.

When the user selects option 2 above, the following should be displayed:

Enter the department name:

If the user enters a name that is not present in the text file, display "The department name doesnot appear in the database.", otherwise, display the location, budget and names of all instructors that work for the department.

If the user selects option 3 above, display the following:

Enter the instructor id:

Enter the instructor name:

Enter the affiliated department name:

Once the user enters the above information, store the information in the instructor file only if the following two conditions are met: 1. The department already exists in the department file. If not, display "The department doesnot exist and hence the instructor record cannot be added to the database". 2. The instructor id should not already be present in the file. If so, display "Instructor id already exists in the file"

The program should work for any number of rows in the two text files.

The code should use good programming practices with sensible variable names, proper indentation and comments where needed.

In: Computer Science

DO NOT ANSWER THIS[1. Write a program named filemaker.py that will be used to store the...

DO NOT ANSWER THIS[1. Write a program named filemaker.py that will be used to store the first name and age of some friends in a text file named friends.txt. The program must use a while loop that prompts the user to enter the first name and age of each friend. Each of these entries should be written to its own line in the text file (2 lines of data per friend). The while loop should repeat until the user presses Enter (Return on a Mac) for the name. Then, the file should be closed and a message should be displayed. See Sample Output. SAMPLE OUTPUT Enter first name of friend or Enter to quit Denny Enter age (integer) of this friend 24 Enter first name of friend or Enter to quit Penny Enter age (integer) of this friend 28 Enter first name of friend or Enter to quit Lenny Enter age (integer) of this friend 20 Enter first name of friend or Enter to quit Jenny Enter age (integer) of this friend 24 Enter first name of friend or Enter to quit File was created] DO NOT ANSWER THIS

Code for the above program

fp = open("friends.txt", "w")

firstname = input("Enter first name of friend or Enter to quit ")

while firstname!="":

age = int(input("Enter age (integer) of this friend "))

print(firstname, file=fp)

print(age, file=fp)

firstname = input("Enter first name of friend or Enter to quit ")

fp.close()

print("File was Created")

the QUESTION IN PYTHON

Now write a program named filereader.py that reads and displays the data in friends.txt. This program should also determine and print the average age of the friends on file. That will require an accumulator and a counter. Use a while loop to process the file, print the data, and modify the accumulator and counter. Then close the file and display the average age accurate to one decimal place. See the Sample Output..
SAMPLE OUTPUT

My friend Denny is 24
My friend Penny is 28
My friend Lenny is 20
My friend Jenny is 24
Average age of friends is 24.0

In: Computer Science

B) DML and SQL Query For this DB Schema, answer the below questions: Employee (Fname, Minit,...

B) DML and SQL Query
For this DB Schema, answer the below questions:
Employee (Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno)
Department (Dname, Dnumber, Mgr_ssn, Mgr_start_date)

5. Delete from Employee table, those who have First name: James.
6. Delete from Employee table, those who have Salary more than 4000.
7. What happens if you try to delete one department?
8. Retrieve the data of all employee.
9. Retrieve the data of all male employee.
10. Retrieve the Fname, Lname of all male employee.
11. Retrieve the Fname, Lname and Salary of all employee
12. Retrieve the Fname, Lname and Salary of all employee with Salary more than 4000
13. Retrieve the Fname, Lname and Salary of all female employee with Salary more than 4000
14. Retrieve the Fname, Lname and Address of all female employee with Salary more than 4000 and Birthdate after 1-1-1990.
15. Retrieve the Address and Salary of all employee with Fname = John or James.
16. Retrieve the Address and Salary of all employee with Fname = John or Birthdate after 1-1-1990
17. Retrieve the Name and Number of all Departments
18. Retrieve the Name and Number of all Departments with Manager SSN=123456
19. Retrieve the Employee Fname, Lnameand Department number for all employees.
20. Retrieve the Employee Fname, Lnameand Department number and Department Name for all employees.
21. Retrieve the Employee Fname, Lnameand who works in Department name = Research
22. Retrieve the Employee Fname, Lnameand who works in Department name = Research and IT
23. Retrieve the Employee Fname, Lnameand who works in Department name = Research OR IT
24. Retrieve the Department Name ,Number , Manager SSN
25. Retrieve the Department Name ,Number , Manager SSN, Manager FName
26. Retrieve the Department Name, Manager SSN, Manager FName for departments with Manager Start Date > 1-1-2010
please write it in computer word not pin and thank you

In: Computer Science

Make Animal an abstract class. Create a Kennel Class Create 2-3 Dog objects Create 2-3 Cat...

Make Animal an abstract class.

  • Create a Kennel Class
    • Create 2-3 Dog objects
    • Create 2-3 Cat objects
  • Put your Dog and Cat objects in an Array of Animals
  • Loop over your Animals and print the animal with Species, Age, and the status of the appropriate vaccines.

Using the code below:

public class Animal {
    //Declaring instance variables
    private int age;
    private boolean RabiesVaccinationStatus;
    private String name;
    private String ownerName;

    //Zero argumented constructor
    public Animal() {

    }
    //Parameterized constructor
    public Animal(int age, boolean rabiesVaccinationStatus, String name,
                  String ownerName) {
        this.age = age;
        RabiesVaccinationStatus = rabiesVaccinationStatus;
        this.name = name;
        this.ownerName = ownerName;
    }

    // getters and setters
    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isRabiesVaccinationStatus() {
        return RabiesVaccinationStatus;
    }

    public void setRabiesVaccinationStatus(boolean rabiesVaccinationStatus) {
        RabiesVaccinationStatus = rabiesVaccinationStatus;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOwnerName() {
        return ownerName;
    }

    public void setOwnerName(String ownerName) {
        this.ownerName = ownerName;
    }

    //toString method is used to display the contents of an object inside it
    public String toString() {
        return "Age :" + age + ", Rabies Vaccination Status :"
                + RabiesVaccinationStatus + ", Name :" + name
                + ", Owner Name :" + ownerName;
    }

}


// Dog.java

class Dog extends Animal {
    //Declaring instance variables
    private boolean distemperVaccinationStatus;

    //Parameterized constructor
    public Dog(boolean distemperVaccinationStatus) {
        this.distemperVaccinationStatus = distemperVaccinationStatus;
    }

    //Parameterized constructor
    public Dog(int age, boolean rabiesVaccinationStatus, String name,
               String ownerName, boolean distemperVaccinationStatus) {
        super(age, rabiesVaccinationStatus, name, ownerName);
        this.distemperVaccinationStatus = distemperVaccinationStatus;
    }

    // getters and setters
    public boolean isDistemperVaccinationStatus() {
        return distemperVaccinationStatus;
    }

    public void setDistemperVaccinationStatus(boolean distemperVaccinationStatus) {
        this.distemperVaccinationStatus = distemperVaccinationStatus;
    }

    //toString method is used to display the contents of an object inside it
    public String toString() {
        return "Dog :"+super.toString() + " Distemper Vaccination Status :"
                + distemperVaccinationStatus;
    }

    public void speak()
    {
        System.out.println("bark");
    }

}

// Cat,.java

class Cat extends Animal {
    //Declaring instance variables
    private boolean felineLeukemiaVaccinationStatus;
    private boolean declawedStatus;

    //Parameterized constructor
    public Cat(boolean felineLeukemiaVaccinationStatus, boolean declawedStatus) {
        this.felineLeukemiaVaccinationStatus = felineLeukemiaVaccinationStatus;
        this.declawedStatus = declawedStatus;
    }
    //Parameterized constructor
    public Cat(int age, boolean rabiesVaccinationStatus, String name,
               String ownerName, boolean felineLeukemiaVaccinationStatus,
               boolean declawedStatus) {
        super(age, rabiesVaccinationStatus, name, ownerName);
        this.felineLeukemiaVaccinationStatus = felineLeukemiaVaccinationStatus;
        this.declawedStatus = declawedStatus;
    }

    // getters and setters
    public boolean isFelineLeukemiaVaccinationStatus() {
        return felineLeukemiaVaccinationStatus;
    }

    public void setFelineLeukemiaVaccinationStatus(
            boolean felineLeukemiaVaccinationStatus) {
        this.felineLeukemiaVaccinationStatus = felineLeukemiaVaccinationStatus;
    }

    public boolean isDeclawedStatus() {
        return declawedStatus;
    }

    public void setDeclawedStatus(boolean declawedStatus) {
        this.declawedStatus = declawedStatus;
    }

    //toString method is used to display the contents of an object inside it
    public String toString() {
        return "Cat :"+super.toString() + " Feline Leukemia Vaccination Status :"
                + felineLeukemiaVaccinationStatus + ", Declawed Status :"
                + declawedStatus;
    }

    public void speak()
    {
        System.out.println("Meow");
    }

}

In: Computer Science

Binary files are convenient to computers because they’re easily machine readable. Text files are human readable,...

Binary files are convenient to computers because they’re easily machine readable. Text files are human readable, but require parsing and conversion to process in the computer. Consider a class Person that has the following structure:

public class Student {
    private String name;
    private int age;
    private double gpa;

    public Student() {
    }

    public Student(String name, int age, double gpa) {
        this.name = name;
        this.age = age;
        this.gpa = gpa;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return this.age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getGpa() {
        return this.gpa;
    }

    public void setGpa(double gpa) {
        this.gpa = gpa;
    }

    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Student{");
        builder.append(String.format("%s=%s", "name", name));
        builder.append(String.format(",%s=%d", "age", age));
        builder.append(String.format(",%s=%.2f", "gpa", gpa));
        builder.append("}");
        return builder.toString();
    }
    
    @Override
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof Student) {
            return equals((Student)obj);
        }
        return false;
    }
    
    public boolean equals(Student other) {
        if (other == null) {
            return false;
        }
        return name.equals(other.name) &&
            age == other.age &&
            Math.abs(gpa - other.gpa) < 0.0001;
    }
}

A number of student records were written out to a file using the toString() method given above. Roughly, they look like the following:

Student{name=Joe O'Sullivan,age=22,gpa=3.14}
Student(name=Jane Robinson,age=19,gpa=3.81}
....
Student{name=Jill Gall,age=21,gpa=2.98}

Your task is to implement a method that will return an array of Students based on a parameter file name that is passed into the method. You will open the text file, read lines, split lines into fields, and then call the setters based on the key/value pairs in the string. Fields will always be in the same order: name, age, gpa. The array should be exactly the same size as the number of lines in the file you are reading. At most, there will be 20 lines in the file. You should not throw any exceptions from the function. if the file doesn't exist, return a zero-length array.

Some hints:

  • You can use the File class to connect the name to the file on disk.
  • You can create a Scanner object by passing in the File to read lines.
  • You can use the split() method of String to take a line from the file and break it up based on delimiters You may need to do this multiple times (e.g. once on a comma, and then on an equals sign).
  • To convert from string data to integer data, use Integer.parseInt(). You can do the same with doubles and Double.parseDouble()

In: Computer Science

Date Open High Low Close Adj Close Volume Rate of return 1/1/2014 1845.859985 1850.839966 1770.449951 1782.589966...

Date Open High Low Close Adj Close Volume Rate of return
1/1/2014 1845.859985 1850.839966 1770.449951 1782.589966 1782.589966 75871910000
2/1/2014 1782.680054 1867.920044 1737.920044 1859.449951 1859.449951 69725590000 0.04311703
3/1/2014 1857.680054 1883.969971 1834.439941 1872.339966 1872.339966 71885030000 0.006932166
4/1/2014 1873.959961 1897.280029 1814.359985 1883.949951 1883.949951 71595810000 0.006200789
5/1/2014 1884.390015 1924.030029 1859.790039 1923.569946 1923.569946 63623630000 0.02103028
6/1/2014 1923.869995 1968.170044 1915.97998 1960.22998 1960.22998 63283380000 0.019058332
7/1/2014 1962.290039 1991.390015 1930.670044 1930.670044 1930.670044 66524690000 -0.015079831
8/1/2014 1929.800049 2005.040039 1904.780029 2003.369995 2003.369995 58131140000 0.037655295
9/1/2014 2004.069946 2019.26001 1964.040039 1972.290039 1972.290039 66706000000 -0.015513837
10/1/2014 1971.439941 2018.189941 1820.660034 2018.050049 2018.050049 93714040000 0.023201461
11/1/2014 2018.209961 2075.76001 2001.01001 2067.560059 2067.560059 63600190000 0.024533589
12/1/2014 2065.780029 2093.550049 1972.560059 2058.899902 2058.899902 80743820000 -0.004188588
1/1/2015 2058.899902 2072.360107 1988.119995 1994.98999 1994.98999 77330040000 -0.031040806
2/1/2015 1996.670044 2119.590088 1980.900024 2104.5 2104.5 68775560000 0.054892511
3/1/2015 2105.22998 2117.52002 2039.689941 2067.889893 2067.889893 76675850000 -0.017396107
4/1/2015 2067.629883 2125.919922 2048.379883 2085.51001 2085.51001 72060940000 0.00852082
5/1/2015 2087.379883 2134.719971 2067.929932 2107.389893 2107.389893 65187730000 0.010491382
6/1/2015 2108.639893 2129.870117 2056.320068 2063.110107 2063.110107 73213980000 -0.021011672
7/1/2015 2067 2132.820068 2044.02002 2103.840088 2103.840088 77920590000 0.01974203
8/1/2015 2104.48999 2112.659912 1867.01001 1972.180054 1972.180054 84626790000 -0.062580818
9/1/2015 1970.089966 2020.859985 1871.910034 1920.030029 1920.030029 79989370000 -0.026442832
10/1/2015 1919.650024 2094.320068 1893.699951 2079.360107 2079.360107 85844900000 0.082983118
11/1/2015 2080.76001 2116.47998 2019.390015 2080.409912 2080.409912 75943590000 0.000504869
12/1/2015 2082.929932 2104.27002 1993.26001 2043.939941 2043.939941 83649260000 -0.017530185
1/1/2016 2038.199951 2038.199951 1812.290039 1940.23999 1940.23999 92409770000 -0.050735322
2/1/2016 1936.939941 1962.959961 1810.099976 1932.22998 1932.22998 93049560000 -0.00412836
3/1/2016 1937.089966 2072.209961 1937.089966 2059.73999 2059.73999 92639420000 0.065991115
4/1/2016 2056.620117 2111.050049 2033.800049 2065.300049 2065.300049 81124990000 0.002699398
5/1/2016 2067.169922 2103.47998 2025.910034 2096.949951 2096.949951 78883600000 0.015324602
6/1/2016 2093.939941 2120.550049 1991.680054 2098.860107 2098.860107 86852700000 0.000910921
7/1/2016 2099.340088 2177.090088 2074.02002 2173.600098 2173.600098 69530250000 0.035609801
8/1/2016 2173.149902 2193.810059 2147.580078 2170.949951 2170.949951 75610310000 -0.001219243
9/1/2016 2171.330078 2187.870117 2119.120117 2168.27002 2168.27002 77270240000 -0.001234451
10/1/2016 2164.330078 2169.600098 2114.719971 2126.149902 2126.149902 73196630000 -0.019425679
11/1/2016 2128.679932 2214.100098 2083.790039 2198.810059 2198.810059 88299760000 0.034174522
12/1/2016 2200.169922 2277.530029 2187.439941 2238.830078 2238.830078 75251240000 0.018200762
1/1/2017 2251.570068 2300.98999 2245.129883 2278.870117 2278.870117 70483180000 0.017884358
2/1/2017 2285.590088 2371.540039 2271.649902 2363.639893 2363.639893 69162420000 0.03719816
3/1/2017 2380.129883 2400.97998 2322.25 2362.719971 2362.719971 81547770000 -0.000389197
4/1/2017 2362.340088 2398.159912 2328.949951 2384.199951 2384.199951 65265670000 0.009091209
5/1/2017 2388.5 2418.709961 2352.719971 2411.800049 2411.800049 79607170000 0.011576251
6/1/2017 2415.649902 2453.820068 2405.699951 2423.409912 2423.409912 81002490000 0.004813775
7/1/2017 2431.389893 2484.040039 2407.699951 2470.300049 2470.300049 63169400000 0.019348826
8/1/2017 2477.100098 2490.870117 2417.350098 2471.649902 2471.649902 70616030000 0.000546433
9/1/2017 2474.419922 2519.439941 2446.550049 2519.360107 2519.360107 66337980000 0.019302979
10/1/2017 2521.199951 2582.97998 2520.399902 2575.26001 2575.26001 70871570000 0.022188135
11/1/2017 2583.209961 2657.73999 2557.449951 2584.840088 2584.840088 95142800000 0.003720043
12/1/2017 2645.100098 2694.969971 2605.52002 2673.610107 2673.610107 65251190000 0.034342557
Average return 0.009018523
Variance 0.000734513
Standard deviation 0.027101906

What are the monthly returns, average monthly returns, and standard deviations for the S&P 500 for this period?

In: Finance

Please TYPE your answers: (a) Name the types of NONsampling error and define them in a...

Please TYPE your answers:

(a) Name the types of NONsampling error and define them in a sentence or two.

(b) Name the types of sampling error and define them in a sentence or two.

In: Statistics and Probability

Triplicates. Given three lists of N names each, devise a linearithmic algorithm to determine if there...

Triplicates. Given three lists of N names each, devise a linearithmic algorithm to determine if there is any name common to all three lists, and if so, return the first such name

In: Computer Science

Explain the three stages in the international product life cycle theory by providing an illustrative example...

Explain the three stages in the international product life cycle theory by providing an illustrative example (please provide the name of the company and the name of the product) to explain each stage of this theory.

In: Operations Management

a) Name one non-mechanical material property for each of the following properties’ category: acoustical, atomic, chemical, electrical, magnetic, optical and thermal properties.

Question 4
a) Name one non-mechanical material property for each of the following properties’ category: acoustical, atomic, chemical, electrical, magnetic, optical and thermal properties.
b) Name six mechanical material properties that pertain to materials presenting elastoplastic behaviors.
c) Name three mechanical material properties that pertain to materials presenting elastic behaviors.

Type the answers, DO NOT DO HAND WRITTING !

In: Civil Engineering