Questions
Linux Question: Describe how you created above file and its contents in VI. a) Bash/VI commands:...

Linux Question: Describe how you created above file and its contents in VI.

a) Bash/VI commands: 20pts;

b) Non-brute-force solution: 10pts).

Note: Brute-force solution means that entering characters one by one

Install JDK 1.8 by the following command: $ sudo dnf –y install java-1.8.0-openjdk-devel.x86_64

Use VI to create a file “YourFirstNameHomework.java” (e.g., “MollyHomework.java”) and add the following contents into it.

(grading details: file name format:10 pts, a screenshot of the file content in the VI environment: 10pts, paragraphs: 10pts, empty lines and indentations: 10, text: 10pts)

import java.util.Scanner; // Import the Scanner class

class CynthiaHomework {

public static void main(String[] args) {

Scanner myObj = new Scanner(System.in); // Create a Scanner object

System.out.println("Enter your first name");

String fName = myObj.nextLine(); // Read user input of the first name

System.out.println("Enter your last name");

String lName = myObj.nextLine(); // Read user input of the last name

System.out.println("Hello " + fName + “ “ + lName); // Output user input

}

}

To compile the above java code, run the following command (you need to use your java file name): $ javac MollyHomework.java

To execute the java program, run the following command $ java MollyHomework

In: Computer Science

Write a java program using the following instructions: Write a program that determines election results. Create...

Write a java program using the following instructions:

Write a program that determines election results. Create two parallel arrays to store the last names of five candidates in a local election and the votes received by each candidate. Prompt the user to input these values. The program should output each candidates name, the votes received by that candidate, the percentage of the total votes received by the candidate, and the total votes cast. Your program should also output the winner of the election. To do this, write the following method: findHighest which receives an array of int. It determine the highest value in the array and returns the location of that value. Call this method to determine the location of the highest value in your votes array, and use this to display the winner from the names array.

SAMPLE OUTPUT:

Enter candidate name: Johnson

Enter votes received: 5000

Enter candidate name: Miller

Enter votes received: 4000

Enter candidate name: Duffy

Enter votes received: 6000

Enter candidate name: Robinson

Enter votes received: 2500

Enter candidate name: Ashton

Enter votes received: 1800

Candidate           Votes Received % of Total

Johnson 5000 25.91

Miller 4000 20.72

Duffy 6000 31.09

Robinson 2500 12.95

Ashton 1800 9.33

Total votes: 19300

The winner of the election is Duffy.

In: Computer Science

Copy d_state.h to your working directory and finish its implementation. Write a program: it first declares...

  1. Copy d_state.h to your working directory and finish its implementation.
  2. Write a program:
    • it first declares a set object s having 5 elements of type stateCity with its initial values such as ("Virginia", "Richmond");
    • then perform the search: input the name of a state, and use the find() function to determine where the state in the set. If the object is present, used the << operator to output the sate and the city; if it is not present, output a message to that effect.
    • Then, rather than using objects of type stateCity, you will implement the program by using a map with state name (string) as the key and the city name (string) as the data value.

d_state.h:

#ifndef STATECITY_CLASS
#define STATECITY_CLASS

#include 
#include 

using namespace std;

// object stores the state name and city in the state
class stateCity
{
        public:
                stateCity (const string& name = "", const string& city = "");

                // output the state and city name in the format
                //    cityName, stateName
                friend ostream& operator<< (ostream& ostr, const stateCity& state;
                
                // operators < and == must be defined to use with set object.
                // operators use only the stateName as the key
                friend bool operator< (const stateCity& a, const stateCity& b);
                
                friend bool operator== (const stateCity& a, const stateCity& b);
        
        private:
                string stateName, cityName;
};

#endif  // STATECITY_CLASS

Please write in C++



Sample Output:

Run 1:

Enter a state: Arizona
Phoenix, Arizona

Run 2:

Enter a state: New York
New York is not in the set

In: Computer Science

The choice experiment method: Select one: a. Is an indirect, stated preference approach for valuing environmental...

The choice experiment method: Select one: a. Is an indirect, stated preference approach for valuing environmental improvements. b. Is an indirect, revealed preference approach for valuing environmental improvements. c. Is a direct, stated preference approach for valuing environmental improvements. d. Is a direct, revealed preference approach for valuing environmental improvements.

In: Economics

1. what is hydrophobic effect? please provide your answer in the context of drug-target intereactions. 2....

1. what is hydrophobic effect? please provide your answer in the context of drug-target intereactions.

2. Discuss thermodynamics of binding (i.e. discuss thermodynamic parameters that affect affinity). How do these parameters are affected by the hydrophobic effect?

3. suggest an experiment to dissect the contribution of these parameters and briefly describe it/

In: Chemistry

An organic chemistry post-lab question from a steam distillation of (+)-Limonene from orange peels using water....

An organic chemistry post-lab question from a steam distillation of (+)-Limonene from orange peels using water.

A.) Could you have performed this experiment using hexane instead of water?

B.) What would end up being different and what would you have to do differently?

In: Chemistry

It has been speculated that gravity does not truly exist as a force in itself, but...

It has been speculated that gravity does not truly exist as a force in itself, but is instead a manifestation of the electrostatic force, which is the force responsible for the repulsion of like-charges and the attraction of opposite charges. Do you believe this is a credible theory? Why or why not. What experiment could you devise to test this theory?

In: Physics

Describe the powder X-ray diffraction experiment. List the basic components in your diagram and discuss the...

Describe the powder X-ray diffraction experiment. List the basic components in your diagram and discuss the features/roles of each component. Include Bragg’s Law as well as coherent and incoherent scattering. What types of information can be obtained using this technique? Pros and cons with respect to single crystal XRD?

In: Chemistry

In one experiment, Marie Curie dissolved 0.09284 g of RaCl2 and treated it with excess AgNO3...

In one experiment, Marie Curie dissolved 0.09284 g of RaCl2 and treated it with excess AgNO3 to precipitate 0.08979 g of AgCl. In her time (1900), the atomic mass of Ag was known to be 107.8 and that of Cl was 35.4. From these values, find the atomic mass of Ra that Marie Curie would have calculated.

In: Chemistry

In an experiment to determine the empirical formula of magnesium oxide a student obtained the following...

In an experiment to determine the empirical formula of magnesium oxide a student obtained the following data:

Mass of crucible and lid: 29.1234 g

Mass of crucible and lid + magnesium: 29.9345 g

Mass of crucible and lid + magnesium oxide: 30.7450 g

Obtain the empirical formula of magnesium oxide using the above data

In: Chemistry