When planning to modify the vehicle’s battery location from the engine [Solved]

Question 1

. When planning to modify the vehicle’s battery location from the engine bay to the passenger or luggage compartment, what are the three [3] requirements to safely carry out this electrical modification under Vehicle Safety Bulletins (VSBS)?
Question 2


Question 3

Given The Following Java Code Segment, Answer The Three Questions Below:

  1. public class BankAccount {
  2.     private double balance;
  3.     public BankAccount() {
  4.         balance = 0;
  5.     }
  6.     public BankAccount(double initialBalance) {
  7.         balance = initialBalance;
  8.         System.out.print(“Balance is: “);
  9.         System.out.println(balance + 10);
  10.     }
  11. }

3.1- Is public BankAccount() considered as a constructor? Why?

3.2- What is the output of “new BankAccount(10.5) “;

3.3- Write a method that may be used to withdraw an amount

Q4. Implement a class Employee. An employee has a name (string) and a salary (double).

4.1- Write a default constructor.

4.2- Write a constructor with two parameters (name and salary).

4.3- Write methods to return the name and salary.

Q5. In the 2- dimensional plane, a point is described by its two coordinates x and y.

It supports these operations:

– A constructor allowing initialization of coordinates

– 4 methods to set and get the values of the coordinates x and y

– Translation of a point

5.1- Write a class, called MyPoint that corresponds to an abstraction of points in the dimensional plane.

5.2- Provide a tester class that creates one point, then translate and display the new coordinates.


Question 4

Java**** For this assignment, refer to the StaffMember class hierarchy Diagram, write the main program to perform the following tasks. (Staff, StaffMemeber, Executive, Hourly and Volunteer class files are provided). Use java.util.ArrayList class

A. Print their employee information with their employment type and their pay of all staff members from the Staff class.

B. Accept name from the keyboard.

C. If the name was found, delete the record from the employee list. If not, display “not found” perform (e) step. Executive record is not allowed to delete.

D. Print the confirmation after the deletion.

E. Accept another name until terminated by the user or the list is empty.

F. Accept name from keyboard to allow the user to modify the staff member Address if it matches the record on the list.

G. Continue (a) until terminate by user.

H. Print the final list with their object type and pay amount.


Answer to question 1

It is important that only trained personnel work on a battery and that they know and observe the safety precautions.  usual safety procedures when handling and working with batteries and stay clear of the modern hybrid batteries that require professional attention are 

1) Ensure that the charger cable clamps or ‘jump start’ leads are in good order and the connections are good. A poor connection can cause an electrical arc which can ignite the hydrogen gas and cause an explosion

2)When working with batteries, prevent exposure by wearing personal protective equipment (PPE).Never attempt to handle car batteries with bare hands. Always use sufficient protective clothing and accessories such as gloves and safety glasses when checking or changing batteries

3)Do not break ‘live’ circuits at the terminals of the battery as this invariably causes a spark to be produced at the point where the circuit is broken.Keep flames or sparks away from the battery always. Do not smoke near batteries.Never place tools or metal objects near to or on top of a battery.Avoid dropping tools across the terminals and use insulated spanners.


Answer to question 2

Electrical System

It is permissible to relocate a vehicle’s battery without specific approval, provided it meets the following requirements:

• the battery is adequately restrained

• battery cables are shielded to prevent damage

• rubber grommets must be fitted where a cable passes through a hole in body panels and/or chassis sections

• battery cables are securely mounted to the vehicle at a maximum spacing of 600mm

• battery cables are adequate to carry the electrical system’s maximum load.

Please note: In addition to the above requirements, a battery relocated in a vehicle’s luggage compartment must be fully enclosed and the enclosure vented to outside the vehicle, unless a special kind of battery, for example, a sealed gel cell is used.

Also, the following are the few things that might need to be known in addition to the above and are to be kept in mind while dealing with batteries of vehicles.

Battery Type

There is a significant difference in safety requirements for different types of batteries. For the purposes of this document, batteries are divided into two principal types: Class A: The batteries do not contain (spillable) liquid and do not discharge gases into the atmosphere during normal operation. Class B: The batteries contain (spillable) liquid and/or discharge gas during normal operation. As a broad classification, lead-acid flooded batteries are Class B, while Nickel Metal Hydride (NiMH) and Lithium batteries are Class A. 2.3 Battery Restraint The batteries that power the vehicle must be fixed in position so that they will not easily break free in a crash and thus create a hazard to the driver, passengers or other road users. The battery restraint system must adequately withstand at least the following crash accelerations: Front impact – 20 g (i.e. 20 times the battery weight); Side impact – 15 g; Rear impact – 10 g; and Vertical (rollover) impact – 10 g. An impact sensing (G force) switch should be fitted to the vehicle so that the traction circuit is opened in the event of an impact. Battery restraints must be designed so that during fitting and maintenance operations, either the restraints or any tools required cannot easily provide a short circuit path for the battery terminals or other exposed wiring and connections. Similarly, it is recommended that insulated tools are used for fitting or maintenance operations.

Containment of Batteries

All batteries that must be vented (i.e. Class B batteries) must be fully sealed from the passenger compartment, so that the transmission of gases or flames is prevented. The sealed compartment should be made from corrosion resistant materials, or if this not practical, lined with corrosive resistant materials. Fully sealed (i.e. Class A batteries) need not comply with this section. Any battery system which is sealed and externally vented, or contains a water replenishing device that connects a number of batteries, must be designed so that propagation of flame between battery cases cannot occur. All batteries must be enclosed to provide water resistance and exclusion of foreign objects, to a rating of at least IP2X (refer Appendix A – International Protection (IP Codes)). As an additional precaution, a roll-over detection switch should also be considered, especially for vehicles powered by Class B batteries that contain spillable liquid. 2.5 Venting of Battery Compartments (Class B Only) The design of the batteries, or battery compartments, must provide for venting directly to atmosphere of all gases given off by normal battery operation. This is of utmost importance for lead-acid batteries because hydrogen can be given off in quantities sufficient to cause an explosion during recharging. Inlets and outlets for venting must be well separated to prevent exhausting gases from re-entering the compartment. Venting must not exit underneath the vehicle because accumulation of potentially explosive gasses may occur. Depending on battery type and the size of the vents, a forced ventilation system may be required. 2.6 Labelling of Battery Compartments Some batteries contain chemicals, particularly acids, which may cause a hazard in the event of a crash. Each battery compartment should be labelled with the appropriate hazard symbols for the battery chemistry in use.

Battery Management

For series strings of batteries, some form of charge or balance management should be implemented. The necessity of this requirement will be dependent on the battery chemistry and technology used in the vehicle. This is especially critical with lithium chemistry batteries which must be maintained within strict upper and lower voltage limits and upper temperature limits. Some form of device to monitor these limits on each individual cell or group of parallel cells should be present. If a monitoring device is fitted, the monitoring device must be capable, of either audibly or visually by means of a flashing lamp, warning the driver of an impending disconnect with sufficient time for the driver to safely park the vehicle before disconnection occurs.


Answer to question 3

3.1 – Yes. public BankAccount() is considered as a constructor of type no-argument default constructor because this is a function and its name is the same as the class name and no return type mentioned.

3.2 – Balance is: 20.5

3.3 – public double withdraw(double amtToWithdraw){

this.balance = this.balance – amtToWithdraw;

return this.balance

}

4 –

public class Employee{

String name;

double salary;

public Employee(){

}

public Employee(String name, double salary){

this.name = name;

this.salary = salary;

}

public String getName(){

return this.name;

}

public double getSalary(){

return this.salary;

}

}

5.1 –

public class MyPoint{

int x,y;

public MyPoint(int x, int y){

this.x = x;

this.y = y;

}

public void setX(int x){

this.x = x;

}

public void setY(int y){

this.y = y;

}

public int getX(){

return this.x;

}

public int getY(){

return this.y;

}

public void translate(int i, int j){

this.setX(this.x + i);

this.setY(this.y + j);

}

}

5.2 –

public class TranslationTest{

public static void main(String args){

MyPoint p = new MyPoint(2,3);

System.out.println(“Coordinates Before Translation: (“+ p.getX() +”,”+p.getY()+”)”);

System.out.println(“Translating the point to (4,5)”);

p.translate(4,5);

System.out.println(“Coordinates after Translation: (“+ p.getX() +”,”+p.getY()+”)”);

}

}


Answer to question 4

  1. import java.util.Scanner;
  2. public class testStaffMember {
  3.   
  4.   
  5.   public static void main(String[] args) {
  6.        
  7.        Scanner sc = new Scanner(System.in);
  8.        Staff staff = new Staff();
  9.        char userChoice = ‘n’;
  10.     
  11.     
  12.        // Print their employee information with their employment type and their pay of all staff members from the Staff class.
  13.        staff.payday();
  14.       
  15.       System.out.print(“Do you want to delete the record of a staff ? (y/n) : “);
  16.       userChoice = sc.next().charAt(0);
  17.       sc.nextLine(); // to take care of newline character
  18.     
  19.       while ( (userChoice == ‘y’) || (userChoice == ‘Y’) )
  20.       {
  21.         
  22.            if (staff.getSize() == 0)
  23.            {
  24.                     System.out.print(“The list is empty. “);
  25.                     return;
  26.            }
  27.            System.out.print(“Enter the name of the staff : “);
  28.            String ename = sc.nextLine();
  29.            boolean found = false;
  30.            for (int i = 0; i < staff.getSize(); i++ ) {
  31.                if ((staff.getStaff(i).getName()).equals(ename) == true )
  32.                {
  33.                      // name found
  34.                      // check if “Executive”
  35.                      if ((staff.getStaff(i).getEmploymentType()).equals(“Executive”) == true)
  36.                         System.out.print(“Records of Executive staff can not be removed from the list. \n”);
  37.                      else
  38.                      {
  39.                          // remove the name from the list
  40.                          staff.removeStaff(i);
  41.                          System.out.print(“Records of “+ename+” removed from the list. \n”);
  42.                          
  43.                      }
  44.                      found = true;
  45.                      break;
  46.                }
  47.         
  48.            } // end of for
  49.            if (found == false)
  50.                System.out.println(“Given name not found in the list….\n”);
  51.       
  52.            System.out.print(“Do you want to delete the record of a staff ? (y/n) : “);
  53.            userChoice = sc.next().charAt(0);
  54.            sc.nextLine(); // to take care of newline character
  55.       } //end of while()
  56.          
  57.       userChoice = ‘n’;
  58.     
  59.       System.out.print(“Do you want to update the staff’s address information ? (y/n) : “);
  60.       userChoice = sc.next().charAt(0);
  61.       sc.nextLine(); // to take care of newline character
  62.     
  63.       while ( (userChoice == ‘y’) || (userChoice == ‘Y’) )
  64.       {
  65.         
  66.            if (staff.getSize() == 0)
  67.            {
  68.                     System.out.print(“The list is empty. “);
  69.                     return;
  70.            }
  71.            System.out.print(“Enter the name of the staff : “);
  72.            String ename = sc.nextLine();
  73.            boolean found = false;
  74.            
  75.            for (int i = 0; i < staff.getSize(); i++ ) {
  76.                if ((staff.getStaff(i).getName()).equals(ename) == true )
  77.                {
  78.                      // name found
  79.                      // get new address information
  80.                      System.out.print(“Enter new address : “);
  81.                      String newAddr = sc.nextLine();
  82.                      staff.updateAddress(i,newAddr);
  83.                      System.out.print(“Address of Staff “+ename+” updated in the list. \n”);
  84.                      found = true;
  85.                      break;
  86.                }
  87.         
  88.            } // end of for
  89.            if (found == false)
  90.                System.out.println(“Given name not found in the list….\n”);
  91.       
  92.            System.out.print(“Do you want to update the staff’s address information ? (y/n) : “);
  93.            userChoice = sc.next().charAt(0);
  94.            sc.nextLine(); // to take care of newline character
  95.       } //end of while()
  96.          
  97.        // Print their employee information with their employment type and their pay of all staff members from the Staff class.
  98.        System.out.println(” P R I N T I N G T H E F I N A L L I S T “);
  99.        staff.payday();
  100.       
  101.     
  102.     }
  103.   
  104.      
  105. }

StaffMember.java

  1. //********************************************************************
  2.   // StaffMember.java //
  3.   // Represents a generic staff member.
  4.  abstract public class StaffMember
  5.   {
  6.   protected String name;
  7.   protected String address;
  8.   protected String phone;
  9.   protected String employmentType; // newly added to hold the type of employee
  10.   
  11.   //—————————————————————–
  12.   // Constructor: Sets up this staff member using the specified
  13.   // information.
  14.   //—————————————————————–
  15.   public StaffMember (String eName, String eAddress, String ePhone, String eType)
  16.   {
  17.   name = eName;
  18.   address = eAddress;
  19.   phone = ePhone;
  20.   employmentType = eType;
  21.   }
  22.   //—————————————————————–
  23.   // Returns a string including the basic employee information.
  24.   //—————————————————————–
  25.   public String toString() {
  26.   String result = “Name: ” + name + “\n”;
  27.   result += “Address: ” + address + “\n”;
  28.   result += “Phone: ” + phone + “\n”;
  29.   result += “Employment Type: ” + employmentType;
  30.   return result;
  31.   }
  32.   //—————————————————————–
  33.   // Derived classes must define the pay method for each type of
  34.   // employee.
  35.   //—————————————————————–
  36.   public abstract double pay();
  37.   
  38.   public String getName()
  39.   {
  40.        return name;
  41.   }
  42.   
  43.   public String getEmploymentType()
  44.   {
  45.        return employmentType;
  46.   }
  47.   
  48.   public void updateStaffAddr(String newAddr)
  49.   {
  50.          address = newAddr;
  51.   }
  52.   
  53.   }

Leave a Comment