Questions
8. A pet food company has a business objective of expanding its product line beyond its...

8. A pet food company has a business objective of expanding its product line beyond its current kidney- and shrimp-based cat foots. The company developed two new products, one based on chicken liver and the other based on salmon. The company conducted an experiment to compare the two new products with its two existing ones, as well as a generic beef-based product sold in supermarket chains.

For the experiment, a sample of 50 cats from the population at a local animal shelter was selected. Ten cats were randomly assigned to each of the five products being tested. Each of the cats was then presented with 3 ounces of the selected food in a dish at feeding time. The researchers defined the variable to be measured as the number of ounces of food that the cat consumed within a 5-minute period that began when the filled dish was presented to the cat. The results for this experiment are summarized in CatFood.

a. At the 0.05 level of significance, is there evidence of a differences in the mean amount of food eaten among the various products?

b. Does the result in (a) give you statistical permission to probe for individual differences between the food products?

Kidney Shrimp Chicken Liver Salmon Beef
3.00 0.25 2.61 0.63 2.97
3.00 0.34 3.00 1.37 2.85
1.47 0.16 3.00 3.00 0.44
2.62 0.72 2.43 0.54 0.90
1.51 3.00 3.00 3.00 3.00
3.00 3.00 3.00 2.55 3.00
3.00 0.29 2.85 2.93 0.48
3.00 3.00 0.18 2.73 0.45
0.74 1.99 0.98 3.00 3.00
2.21 2.30 1.51 0.96 0.05

In: Statistics and Probability

A pet food company has a business objective of expanding its product line beyond its current...

A pet food company has a business objective of expanding its product line beyond its current kidney- and shrimp-based cat foots. The company developed two new products, one based on chicken liver and the other based on salmon. The company conducted an experiment to compare the two new products with its two existing ones, as well as a generic beef-based product sold in supermarket chains.

For the experiment, a sample of 50 cats from the population at a local animal shelter was selected. Ten cats were randomly assigned to each of the five products being tested. Each of the cats was then presented with 3 ounces of the selected food in a dish at feeding time. The researchers defined the variable to be measured as the number of ounces of food that the cat consumed within a 10-minute period that began when the filled dish was presented to the cat. The results for this experiment are summarized in CatFood.

a. At the 0.05 level of significance, is there evidence of a differences in the mean amount of food eaten among the various products?

b. Does the result in (a) give you statistical permission to probe for individual differences between the food products?

Please show me how to do this in excel using the data analysis tab

Kidney Shrimp Chicken Liver Salmon Beef
2.37 2.26 2.29 1.79 2.09
2.62 2.69 2.23 2.33 1.87
2.31 2.25 2.41 1.96 1.67
2.47 2.45 2.68 2.05 1.64
2.59 2.34 2.25 2.26 2.16
2.62 2.37 2.17 2.24 1.75
2.34 2.22 2.37 1.96 1.18
2.47 2.56 2.26 1.58 1.92
2.45 2.36 2.45 2.18 1.32
2.32 2.59 2.57 1.93 1.94

In: Math

Synthesis of banana oil this is my discussion and below it is the professors comments. Can...

Synthesis of banana oil

this is my discussion and below it is the professors comments. Can you correct it for me?

Discussion:

            The purpose of the experiment performed was to synthesize isopentyl acetate, or more commonly known as banana oil, from isopentyl alcohol and glacial acetic acid. Both liquids were combined and remained clear until the addition of concentrated sulfuric acid. The addition of an acid caused a reaction to occur that resulted in a polymer, which gave the mixture color. The liquid turned dark brown when the polymer formed. The polymer was removed via distillation.

            After creating the ester, the biggest challenge was separating it from all the other chemicals in the flask, which include water, acetic acid, sulfuric acid, and isopentyl alcohol. The isopentyl acetate is not soluble in water; so two layers are created in the separatory funnel. While the product will not dissolve in water, both acetic acid and sulfuric acid are. Since the acids are also slightly in the organic layer, sodium bicarbonate is used to convert the acids into a salt, which is soluble in water, as seen in Figure 2. The sodium bicarbonate reaction also produces carbonic acid, which is unstable and will break down into water and CO2 as seen in Figure 3. The little amount of unreacted isopentyl alcohol is separated by removing the first ten drops of product during the distillation. This is possible because it has a lower boiling point then the ester that is produced.

            This whole reaction was first done and called the Fischer esterification. The general reaction scheme can be seen above. In the experiment, isopentyl alcohol and acetic acid react in the presence of sulfuric acid to form isopentyl acetate. This reaction mechanism can be seen below in Figure 5.

Figure 5 – Fischer esterification mechanism

In the reaction above, Acetic acid takes a proton from concentrated sulfuric acid. Then it reacts with isopropentyl alcohol. Delocalization of electrons and protons in later steps leads to elimination of water molecule to form final product.

            During the distillation, the temperature was recorded for the boiling point of isopentyl acetate. It was found to be at 129 degrees Celsius. This is low compared to the literature value of 142 degrees Celsius. This difference is believed to be due to the different typed of thermometers used to record the boiling point. The literature value most likely used a mercury thermometer, while the experiment performed used an alcohol thermometer. Alcohol thermometers are not as accurate as mercury thermometers, but have to be used due a law banning mercury thermometers in the state of New Jersey. Because of this, not much can be said about the purity of the substance obtained.

            While an NMR was not taking during the experiment, nor was an IR spectrum, attached is both an NMR example and an IR example of isopentyl acetate. On the NMR sheet, all hydrogen peaks are labeled on a drawing of the molecule, and all the information is written in the chart. On the IR sheet, peaks above 1500 cm-1 are labeled for what they are believed to be. While the pictures were found from a reputable source, they were not from the experiment performed so one cannot be perfectly sure that the desired substance was obtained.

            The last topic for the reaction was the product loss. Most organic reactions are not perfect and have relatively low yields. The 42 percent yield was most likely due to side reactions occurring in the flask. Since there were several chemicals in the flask together, side reactions are bound to occur, creating a lower yield. For example, a polymer was formed which changed the color of the flask. This was not intended to happen so this reaction lowered the yield of the experiment.

professors comments.

You need to explain what substances should have been in the flask at the end of refluxing. Show a flow

diagram of the purification process. You did an extraction, a drying and a distillation.

Alcohol thermometers are quite accurate in the range they are designed to function. This type of

alcohol thermometer was not designed to work around 142 degrees C.

Treat the NMR and IR spectra as if they were obtained by you for your product. You should have tables

in your Results Section for IR, NMR and GC. You should discuss these results in more detail in the

discussion. What do we learn from each measurement.

Give more details of the many causes for obtaining less than 100% Yield.

Discuss whether this experiment is a good example of Green Chemistry. Does the Atom efficiency make

it a good candidate. Does the Reaction efficiency make it a good example of Green chemistry. What

about other things.

In: Chemistry

A Java question. You are given a Student class. A Student has a name and an...

A Java question. You are given a Student class. A Student has a name and an ArrayList of grades (Doubles) as instance variables.

Write a class named Classroom which manages Student objects.

You will provide the following:

1. public Classroom() a no-argument constructor.
2. public void add(Student s) adds the student to this Classroom (to an ArrayList
3. public String hasAverageGreaterThan(double target) gets the name of the first student in the Classroom who has an average greater than the target or the empty string. Do not use break. Do not return from the middle of the loop. Use a boolean flag if you need to terminate early.
4. public ArrayList<String> getStudents() gets an ArrayList<String> containing the names of all the Students in this Classroom.
5. public Student bestStudent() gets the Student with the highest average in this classroom or null there are no students
6. public String toString() gets a string represent ion using ArrayList's toString method

Provide Javadoc

-------------------------------------------------------------------------------------------------

ClassroomTester.java

import java.util.ArrayList;

public class ClassroomTester
{
public static void main(String[] args)
    {
       ArrayList<Double> grades1 = new ArrayList<>();
       grades1.add(82.0);
       grades1.add(91.5);
       grades1.add(85.0);
       Student student1 = new Student("Srivani", grades1);
      
       ArrayList<Double> grades2 = new ArrayList<>();
       grades2.add(95.0);
       grades2.add(87.0);
       grades2.add(99.0);
       grades2.add(100.0);
       Student student2 = new Student("Carlos", grades2);
       
       ArrayList<Double> grades3 = new ArrayList<>();
       grades3.add(100.0);
       grades3.add(98.0);
       grades3.add(100.0);
       grades3.add(97.0);
       Student student3 = new Student("Maria", grades3);
       
       ArrayList<Double> grades4 = new ArrayList<>();
       grades4.add(80.0);
       grades4.add(70.0);
       grades4.add(82.0);
       grades4.add(75.0);
       Student student4 = new Student("Fred", grades4);
       
       Classroom myClass = new Classroom();
       myClass.add(student1);
       myClass.add(student2);
       myClass.add(student3);
       myClass.add(student4);
       
       System.out.println(myClass);
       System.out.println("Expected: [[Student:name=Srivani,grades=[82.0, 91.5, 85.0]], [Student:name=Carlos,grades=[95.0, 87.0, 99.0, 100.0]], [Student:name=Maria,grades=[100.0, 98.0, 100.0, 97.0]], [Student:name=Fred,grades=[80.0, 70.0, 82.0, 75.0]]]");
       
       System.out.println(">90 GPA: " + myClass.hasAverageGreaterThan(90.0));
       System.out.println("Expected: Carlos");
       
       System.out.println(">99 GPA: " + myClass.hasAverageGreaterThan(99));
       System.out.println("Expected: ");
       
       Student best = myClass.bestStudent();
       if (best != null)
       {
          System.out.println(best.getName());
          System.out.println("Expected: Maria");
       }
       
       System.out.println(myClass.getStudents());
       System.out.println("Expected: [Srivani, Carlos, Maria, Fred]");
       
       //test with an empty classroom
       myClass = new Classroom();
       System.out.println(myClass);
       System.out.println("Expected: []");
       
       System.out.println(">90 GPA: " + myClass.hasAverageGreaterThan(90.0));
       System.out.println("Expected: ");
       
      
       best = myClass.bestStudent();
       if (best != null)
       {
          System.out.println(best.getName());
          
       }
       
       System.out.println(myClass.getStudents());
       System.out.println("Expected: []");
        
    }
}

Student.java

import java.util.ArrayList;
/**
 * Models a student with a name and collection
 * pf grades
 */
public class Student
{
    private String name;
    private ArrayList<Double> grades;

    /**
     * Constructor for Student with name 
     * and list of grades
     * @param name the name of the student
     * @param list the list of grades
     */
    public Student(String name, ArrayList<Double> list)
    {
        this.name = name;
        this.grades = list;
    }
    
    /**
     * Gets the name of the student
     * @return the student's name
     */
    public String getName()
    {
        return name;
    }
    
    /**
     * Gets the average of this student's grades
     * @return the average or 0 if there are no grades
     */
    public double getAverage()
    {
        double sum = 0;
        for ( double g : grades)
        {
            sum = sum + g;
        }
        
        double average = 0;
        if (grades.size() > 0)
        {
            average = sum / grades.size();
        }
        
        return average;
    }
    
    /**
     * @overrides
     */
    public String toString()
    {
        String s = "[Student:name=" + name 
           + ",grades=" + grades.toString() +"]";

        return s;
    }

}

In: Computer Science

In Java. Modify the attached GameDriver2 to read characters in from a text file rather than...

In Java. Modify the attached GameDriver2 to read characters in from a text file rather than the user. You should use appropriate exception handling when reading from the file. The text file that you will read is provided.

-------------------- Modify GaveDriver2.java --------------------

-----GameDriver2.java -----

import java.io.File;
import java.util.ArrayList;
import java.util.Scanner;

/**
* Class: GameDriver
*
* This class provides the main method for Homework 2 which reads in a
* series of Wizards, Soldier and Civilian information from the user
* and creates the objects
*
*/
public class GameDriver2
{

/**
* Main method- Starting point of program
*
* @param args
*/
public static void main(String[] args)
{

// create needed variables
ArrayList characters = new ArrayList();

// YOU CHANGE THIS LINE to opening file Characters.txt - use appropriate exception handling
// don't
// just throw the exception
Scanner in = new Scanner(System.in);

// End first change

// HERE IS CODE THAT READS A LINE AND CREATES APPROPRIATE CHARACTER

while (in.hasNextLine())
{
// read in a line and parse into various attributes
String line = in.nextLine();

// parse based on comma
String[] data = line.split(", ");
String type = data[0];
String name = data[1];
int strength = Integer.parseInt(data[2]);
String weapon = data[3];
int magic = Integer.parseInt(data[4]);
  
// use this data to build appropriate GameCharacter based on type and add to ArrayList
// YOU ADD THIS CODE

}
// print array before hits or healing
for (GameCharacter g : characters)
{
System.out.println(g);
}

System.out.println();
System.out.println("After soldier takes a hit and civilian is healed");

// print contents of arrayList
for (int i = 0; i < characters.size(); i++)
{
GameCharacter g = characters.get(i);
// if a civilian - heal them
if (g instanceof Civilian)
{
g.heal(5);
}
// else if a soldier - takes a hit
else if (g instanceof Soldier)
{
g.takeHit(5);
}

System.out.println(g);
}

}

}

----- GameCharacter.java -----

  


/**
* Class: GameCharacter
*
* This class provides a parent class for characters to be created for
* our game.
*
*/
public class GameCharacter {
   // attributes for all GameCharacters
   private String name;
   private int strength;

   /**
   * Name Setter
   *
   * @param name the name to set
   */
   public void setName(String name) {
       this.name = name;
   }

   /**
   * Strength setter method
   *
   * Makes sure strength is a legit value. Ignores otherwise
   *
   * @param strength the strength to set
   */
   public void setStrength(int strength) {
       if (strength > 0 && strength <= 18) {
           this.strength = strength;
       } else {
           this.strength = 12; // default number I made up
       }
   }

   /**
   * All arg constructor
   *
   * @param name
   * @param strength
   */
   public GameCharacter(String name, int strength) {
       super();
       this.name = name;
       setStrength(strength);
   }

   /**
   * No-arg (default) constructor
   */
   public GameCharacter() {
       this.strength = 15;
       this.name = "TBD";
   }

   /**
   * Getter method for name
   *
   * @return the name
   */
   public String getName() {
       return name;
   }

   /**
   * Getter method for strength
   *
   * @return the strength
   */
   public int getStrength() {
       return strength;
   }

   /**
   * method: takeHit() Method called when character is attacked and has lost
   * strength
   *
   * @param int amount
   */
   public void takeHit(int amount) {
       strength = strength - amount;
       if (strength < 0) {
           strength = 0;
       }
   }

   /**
   * Method: heal()
   *
   * Method called as character heals from a hit
   *
   * @param int amount
   *
   */
   public void heal(int amount) {
       strength = strength + amount;
       if (strength > 18) {
           strength = 18;
       }
   }

}

----- Characters.txt -----

Soldier, Sol, 14, Sword, 50
Wizard, Wiz, 5, Staff, 444
Civilian, Civ, 18, Words, 3
Soldier, Joe, 3, Gun, 0
Wizard, Gandalf, 10, Wand, 500
Civilian, Frodo, 16, Money, 40

I can provide the 3 child classes (Soldier, Wizard, Civilian) if needed as the code exceed the text limits.

In: Computer Science

Instructions: You are givne main.c and exam.h. Your task is to implement exam.c. write the code...

Instructions:
You are givne main.c and exam.h.
Your task is to implement exam.c.
write the code for these 20 functions on repl.it.
*/

#include 
#include "exam/exam.h"

int main(void) {
  return 0;
}
/*
/*
exam.h
*/

#ifndef _EXAM_H_
#define _EXAM_H_

// 1
// Display title of code and your name. ( koorsh maghsoodi my name)
// See exam.txt for sample output.
void exam_hello_world(void);

// 2
// Display argc and all argv[] values.
// See exam.txt for sample output.
// returns: number of arguments
int exam_cmd_line_args(int argc, char *argv[]);

// 3
// Display info about signed integer data types.
// See exam.txt for sample output.
// Return number of signeed integer data types
int exam_signed_integer_data_types(void);

// 4
// Display info about unsigned integer data types.
// See exam.txt for sample output.
// Return number of unsigned integer data types
int exam_unsigned_integer_data_types(void);

// 5
// Display info about these data types:
// int8_t, uint8_t
// int16_t, uint16_t
// int32_t, uint32_t
// See exam.txt for sample output.
// Return number of unsigned integer data types
int exam_stdint_integer_data_types(void);

// 6
// Display info about floating-point data types.
// See exam.txt for sample output.
int exam_floating_data_types(void);

// 7
// Return the sum of three integer numbers.
// See exam.txt for sample output
int exam_sum(int n1, int n2, int n3);

// 8
// Given two integer numbers, return:
// -1 if n1 is less than n2
// 0 if n1 is equal to n2
// 1 if n1 is greater than n2
// See exam.txt for sample output
int exam_compare(int n1, int n2);

// 9
// Given two integer numbers,
// return the sum of n1 to n2.
// For example, if n1=2 and n2=4,
// return sum of 2+3+4, i.e. 9
// Do this using a for loop.
int exam_for(int n1, int n2);

// 10
// Given two integer numbers,
// return the sum of n1 to n2.
// For example, if n1=2 and n2=4,
// return sum of 2+3+4, i.e. 9
// Do this using a while loop.
int exam_while(int n1, int n2);

// 11
// Given two integer numbers,
// return the sum of n1 to n2.
// For example, if n1=2 and n2=4,
// return sum of 2+3+4, i.e. 9
// Do this using a do_while loop.
int exam_do_while(int n1, int n2);

// 12
// Display info about enum data types.
// See exam.txt for sample output.
typedef enum {
  EXAM_ERROR_OK = 0,
  EXAM_ERROR_BAD_PARAM,
  EXAM_ERROR_OUT_OF_RANGE,
  EXAM_ERROR_IO
} exam_error_t;
exam_error_t exam_typedef_enum_data_types(void);

// 13
// Add a student.
// If the max students is reached return
// EXAM_ERROR_OUT_OF_RAMGE,
// else return EXAM_ERROR_OK
// See exam.txt for sample output
#define EXAM_MAX_STUDENTS 3
typedef struct {
  int id;
  float average;
  char *name;
} student_t;
exam_error_t exam_add_student(student_t *s);

// 14
// List all students
// See exam.txt for sample output
// Return the number of students listed
int exam_list_students(void);

// 15
// Remove a student by id 
// See exam.txt for sample output
// Return EXAM_ERROR_OK if studentt was
// removed. Else return EXAM_ERROR_BAD_PARAM
exam_error_t exam_remove_student_by_id(int id);

// 16
// Remove a student by name
// See exam.txt for sample output
// Return EXAM_ERROR_OK if studentt was
// removed. Else return EXAM_ERROR_BAD_PARAM
exam_error_t exam_remove_student_by_name(char *name);

//17
// Write the list of students to a file.
// Return EXAM_ERROR_OK on success or
// Return EXAM_ERROR_BAD_PARAM if filenmae is NULL.
// Return EXAM_ERROR_IO if file write error
exam_error_t exam_write_students_to_file(char *filename);

//18
// Read the list of students from a file.
// Return EXAM_ERROR_OK on success or
// Return EXAM_ERROR_BAD_PARAM if filenmae is NULL.
// Return EXAM_ERROR_IO if file write error
exam_error_t exam_read_students_from_file(char *filename);

//19
// Given an array of students (e.g. just read in from a file)
// display them to the console.
// Return the number of students displayed.
int exam_display_students_from_list(student_t s[], size_t size);

//20
// For each of the following files, read them in,
// and then display the following info:
// Filename, Number of Lines, Number of Characters
// main.c....
// exam/exam.h....
// exam/exam.c...
// Return the total number of LINES of all files,
// i.e. lines of main.c + exam.h + exam.c
int exam_return_total_lines(void);

#endif

YOUR SAMPLE OUTPUT SHOULD LOOK LIKE THIS:

1 - exam_hello_world
        CSCI 112 Final
        Code by Norman McEntire
2 - exam_cmd_line_args
        argc: 4
        argv[0]: main
        argv[1]: one
        argv[2]: two
        argv[3]: three
value returned: 4
3 - exam_signed_integer_data_types
        type    size
        ----    ----
        char    1
        short   2
        int     4
        long    8
value returned: 4
4 - exam_unsigned_integer_data_types
        type    size
        ----    ----
        unsigned char   1
        unsigned short  2
        unsigned int    4
        unsigned long   8
value returned: 2
5 - exam_stdint_integer_data_types
        type            size
        ----            ----
        uint8_t         1
        uint16_t        2
        uint32_t        4
value returned: 3
6 - exam_floating_data_types
        type    size
        ----    ----
        float   4
        double  8
value returned: 2
7 - exam_sum
        n1: 10, n2: 20, n3: 30
value returned: 60
8 - exam_compare
        n1: -10, n2: 20
value returned: -1
8 - exam_compare
        n1: 10, n2: 10
value returned: 0
8 - exam_compare
        n1: 20, n2: 10
value returned: 1
9 - exam_for
        n1: 10, n2: 20
value returned: 165
10 - exam_while
        n1: 10, n2: 20
value returned: 165
11 - exam_do_while
        n1: 10, n2: 20
value returned: 165
12 - exam_typedef_enum_data_types
        EXAM_ERROR_OK: 0
        EXAM_ERROR_BAD_PARAM: 1
        EXAM_ERROR_OUT_OF_RANGE: 2
        EXAM_ERROR_IO: 3
13 - exam_add_student
        id: 123, average: 94.50, name: John
        Currrent num_students: 0
        Student added. updated num_students: 1
value returned: 0
13 - exam_add_student
        id: 234, average: 95.60, name: Sally
        Currrent num_students: 1
        Student added. updated num_students: 2
value returned: 0
13 - exam_add_student
        id: 345, average: 96.70, name: Billy
        Currrent num_students: 2
        Student added. updated num_students: 3
value returned: 0
13 - exam_add_student
        id: 456, average: 97.80, name: Paul
        Currrent num_students: 3
        Max number of students reachd!
value returned: 2
14 - exam_list_students
        Total of 3 students:
        id: 123, average: 94.50, name: John
        id: 234, average: 95.60, name: Sally
        id: 345, average: 96.70, name: Billy
value returned: 3
15 - exam_remove_student_by_id
        id: 234
        FOUND! Student removed!
value returned: 0
14 - exam_list_students
        Total of 2 students:
        id: 123, average: 94.50, name: John
        id: 345, average: 96.70, name: Billy
value returned: 2
15 - exam_remove_student_by_id
        id: 999
        NO STUDENT FOUND!
value returned: 1
14 - exam_list_students
        Total of 2 students:
        id: 123, average: 94.50, name: John
        id: 345, average: 96.70, name: Billy
value returned: 2
16 - exam_remove_student_by_name
        name: Billy Bob
        NO STUDENT FOUND!
value returned: 1
14 - exam_list_students
        Total of 2 students:
        id: 123, average: 94.50, name: John
        id: 345, average: 96.70, name: Billy
value returned: 2
16 - exam_remove_student_by_name
        name: No One
        NO STUDENT FOUND!
value returned: 1
14 - exam_list_students
        Total of 2 students:
        id: 123, average: 94.50, name: John
        id: 345, average: 96.70, name: Billy
value returned: 2
13 - exam_add_student
        id: 234, average: 95.60, name: Sally
        Currrent num_students: 2
        Student added. updated num_students: 3
value returned: 0
13 - exam_add_student
        id: 456, average: 97.80, name: Paul
        Currrent num_students: 3
        Max number of students reachd!
value returned: 2
14 - exam_list_students
        Total of 3 students:
        id: 123, average: 94.50, name: John
        id: 234, average: 95.60, name: Sally
        id: 345, average: 96.70, name: Billy
value returned: 3
17 - exam_write_students_to_file
        filename: (null)
Error: filename is NULL
value returned: 1
17 - exam_write_students_to_file
        filename: asdf.txt
value returned: 0
18 - exam_read_students_from_file
        filename: asdf.txt
        123 94.500000 John
        234 95.599998 Sally
        345 96.699997 Billy
value returned: 0
19 - exam_display_students_from_list
id: 11, average: 90.11, name: Sam
id: 22, average: 90.22, name: Jack
id: 33, average: 90.33, name: Lisa
value returned: 0
20 - exam_return_total_lines
        main.c:         lines: 253, chars: 6881
        exam/exam.h:    lines: 158, chars: 4059
        exam/exam.c:    lines: 398, chars: 10282
Total lines: 809

In: Computer Science

A text editor window should pop up with the following source code (except with your actual name):

 

  1. A text editor window should pop up with the following source code (except with your actual name):
    1. csci1011.lab8;

      /**
      *
      * @author Your Name
      */
      public class Account {

      }
  1. Implement the Account class.
    1. Add a public enum called ACCOUNT_TYPE with two values CHECKING, SAVING
    2. Add the following private instance variables to the Account class:
      • An instance variable called aType of type Enum ACCOUNT_TYPE.
      • An instance variable called accountOwner of type String.
      • An instance variable called interestRate of type double.
      • An instance variable called balance of type double
    3. Add getters and setters for the four instance variables of item (b) to the Account class:
    4. Add the following methods to the Account class:
      • A void method called initialize that takes a parameter of type ACCOUNT_TYPE, a String, two doubles and uses those arguments to set the values of the accountType, accountOwner, interestRate, and balance instance variables.
      • A void method called display that displays the account information.
      • A void method called deposit with one parameter of double that adds the given parameter to the balance instance variable.
      • A void method called withdraw with one parameter of double that deduct the given parameter from the balance instance variable. This method prints an error message when the given parameter is greater than the balance. In this case no money should be withdrawn from the account.
  • In the main method of your main class, create two Account objects and perform the following:
    • Initialize the first account objects with SAVING as the accountType and other parameters of your own choice.
    • Initialize the first account objects with CHECKING as the accountType and other parameters of your own choice.
    • Display both accounts.
    • Deposit $200 from the first account
    • Withdraw $500 from the second account
  • Display both accounts.
  • Run the main program to see if the tests were successful.
    • Here is a sample output of the program.

Account Type: SAVING

Account Owner: Customer B

Interest Rate: 1.1

Balance: 500.0

 

Account Type: CHECKING

Account Owner: Customer A

Interest Rate: 1.2

Balance: 200.0

 

Cannot withdraw more than account balance

 

Account Type: SAVING

Account Owner: Customer B

Interest Rate: 1.1

Balance: 700.0

 

Account Type: CHECKING

Account Owner: Customer A

Interest Rate: 1.2

Balance: 200.0

 

solution provided:


package csci1011.csci1011.lab8;

import java.text.NumberFormat;
import java.text.DecimalFormat;

class Account {
enum ACCOUNT_TYPE
{
CHECKING,SAVINGS;
}
//create five variable
private ACCOUNT_TYPE aType;
private String accountOwner;
private double interestRate;
private double Balance;

//setter and getter methods
private ACCOUNT_TYPE getaType() {
return aType;
}

private void setaType(ACCOUNT_TYPE aType) {
this.aType = aType;
}

private String getAccountOwner() {
return accountOwner;
}

private void setAccountOwner(String accountOwner) {
this.accountOwner = accountOwner;
}

private double getInterestRate() {
return interestRate;
}

private void setInterestRate(double interestRate) {
this.interestRate = interestRate;
}

private double getBalance() {
return Balance;
}

private void setBalance(double Balance) {
this.Balance = Balance;
}
void initialize(ACCOUNT_TYPE atype,String name,double interestRate,double balance)
{
setaType(atype);
setAccountOwner(name);
setInterestRate(interestRate);
setBalance(balance);
  
}
void display()
{
System.out.println(" Account Type : "+aType.name());
System.out.println("Account Owner : "+getAccountOwner());
System.out.println("Interest Rate : "+getInterestRate());
System.out.println("Balance : "+getBalance());
}
//deposit to the account
void deposit(double amount)
{

double bal=getBalance();
setBalance(bal+amount);
System.out.println("Successfull Deposit ! ");
}
//withdraw from account
void withdraw(double amount)
{
//if balance is 0 or amount is greater than balance
if(getBalance()<=0 || amount>getBalance())
{
System.out.println("You don't have enough money to withdraw");
}
else
{
double bal=getBalance();
setBalance(bal-amount);
System.out.println("Successfully withdrawn ");
}

}
public static void main(String args[])
{
//two objects
Account ac=new Account();
Account ac1=new Account();
  
//initialize with Savings
ac.initialize(ACCOUNT_TYPE.SAVINGS, "Customer B ", 1.1, 500);
//initialize with Checking
ac1.initialize(ACCOUNT_TYPE.CHECKING, "Customer A ", 1.2, 200);
//display
ac.display();
ac1.display();
//deposit into account
ac.deposit(20);
//withdraw from account
ac.withdraw(60);
//display
ac.display();
  
  
  
}
}

In: Computer Science

Part D - Labeling the Spinal AnatomyDrag the name of the nervous tissue to the...

Part D - Labeling the Spinal Anatomy


Drag the name of the nervous tissue to the proper spot on the image.


Drag the name of the nervous tissue to the proper spot on the image. Drag the appropriate labels to their respective targets.


Drag the name of the nervous tissue to the proper spot on the image. Drag the appropriate labels to their respective targets.

Spinal nerve 

Posterior ramus 

Motor nuclei 

Anterior root 

Posterior root 

Anterior ramus

In: Other

Your company has created the table below: VENDOR (VENDOR#, VENDOR-NAME, VENDOR-ADDRESS) The company will add other...

Your company has created the table below: VENDOR (VENDOR#, VENDOR-NAME, VENDOR-ADDRESS) The company will add other secondary fields later, but no matter which secondary field it adds, which normal form will this table never violate? Why?


VENDOR (VENDOR#, VENDOR-NAME, VENDOR-ADDRESS)

In: Economics

What does it mean to "make a name" for oneself? Does it always mean the same...

What does it mean to "make a name" for oneself? Does it always mean the same thing or not? Consider the example of Gilgamesh before he sets out to slay Humbaba in The Epic of Gilgamesh (p. 20) and the example of Genesis 11.4. What does it mean in each text, respectively, to make one's name?

In: Psychology