practical1_answer

// Computer.Java Ths is the Super class from whch laptops and Desktops will inherit the attributes of this class
public abstract class ComputerObject {
	//Here we declare all of the superclass variables that will be used by both Laptops and desktops
	//These are attributes of all computers
	private int usefulLife = 1; 
	private String stockCode = "XXXXXXXX";
	private int purchasingCost = 10000;
	private String staffNumber = "XXXXXXXX";
	private String serialNumber = "ABCDEFG";
	private String cpuType = "Multicore Parallel Threading";
	private int ramAmount = 12;
	  
	/**Default construct Need only be present and we do not need any additional constructors except the one below*/
	 protected ComputerObject() { }
	 
	/**Construct a full Computer object. We receive all of the variable information and place them in the correct private variables using our mutators*/
    /* we use mutators because validation is often done in mutators*/	
	protected ComputerObject(int usefulLife, String stockCode,int purchasingCost,String staffNumber,String serialNumber ,String cpuType, int ramAmount) { 
		setUsfulLife(usefulLife);
		setPurchasingCost(purchasingCost);
		setRamAmount(ramAmount);
		setStockCode(stockCode);
		setStaffNumber(staffNumber);
		setCpuType(cpuType);
		setSerialNumber(serialNumber);
	}
	 
	/**Getter/Accessor method for usefulLife*/ 
	public int getUsfulLife(){
		return usefulLife; 
	 }
	 

	/**Setter/Mutator method for usefulLife*/ 
	public void setUsfulLife(int usefulLife){
		this.usefulLife = usefulLife;
	 } 
	 /**Getter/Accessor method for purchasingCost*/ 
	 public int getPurchasingCost(){
		return purchasingCost; 
	 }
	 
	/**Setter/Mutator method for purchasingCost*/ 
	public void setPurchasingCost(int purchasingCost){
		this.purchasingCost = purchasingCost;
	 } 
	 
	 /**Getter/Accessor method for ramAmount*/ 
	 public int getRamAmount(){
		return ramAmount; 
	 }
	 
	/**Setter/Mutator method for ramAmount*/ 
	public void setRamAmount(int ramAmount){
		this.ramAmount = ramAmount;
	 } 
	 
	 
	 /**Getter/Accessor method for stockCode*/ 
	public String getStockCode(){
		return stockCode; 
	 }
	 
	/**Setter/Mutator method for stockCode*/ 
	public void setStockCode(String stockCode){
		this.stockCode = stockCode; 
	 } 
	 
	 
	  /**Getter/Accessor method for staffNumber*/ 
	public String getStaffNumber(){
		return staffNumber; 
	 }
	 
	/**Setter/Mutator method for staffNumber*/ 
	public void setStaffNumber(String staffNumber){
		this.staffNumber = staffNumber ;
	 } 

	 /**Getter/Accessor method for cpuType*/ 
	public String getCpuType(){
		return cpuType; 
	 }
	 
	/**Setter/Mutator method for cpuType*/ 
	public void setCpuType(String cpuType){
		this.cpuType = cpuType ;
	 } 
	 
	 
	 
	  /**Getter/Accessor method for serialNumber*/ 
	public String getSerialNumber(){
		return serialNumber; 
	 }
	 
	/**Setter/Mutator method for serialNumber*/ 
	public void setSerialNumber(String serialNumber){
		this.serialNumber = serialNumber ;
	 } 
	 
	/**Abstract method AnnualDepreciation*/ 
	//The implimentations of this method can be found in the Laptop and Desktop sub classes
	public abstract double AnnualDepreciation(); 
}

Java相关代码片段

logging in spring boot

how to split a list in multiple lists java

can two servlet have same urlpattern

spring debug

jsp spring

hanoi tower recursion java

java equals

age difference java

sed cheat sheet

java compare method

how to make a activity default in manifest

java max memory size

yum uninstall java

timestamp to long java

how to set background image in android studio

simple calculator in android

When to use HashMap vs Map

spring boot jpa

spring data jpa

spring jdbc

jpa vs hibernate

java with checking the password matching

profile in spring boot

string templates java

spring rest controller

java arraylist get item

com.oracle.jdbc

check if map is not empty java

how to install java 8 on debian 12

regex caractères spéciaux java

java 11 yum install

manage session in redis spring boot

java: error: release version 19 not supported

bean scope in spring

xml configuration in spring

spring cdi annotations

postconstruct and predestroy in spring

java decode_message

spring lazy initialization

java decorator design pattern

dependency injection in spring

check back pressed in fragment andorid

send email to any domain using java

record java

vs code setup for input/output in java

substring java

receive second word in string java

loose coupling in java

default value of char in java

spring boot repository pattern

spring boot h2 database

add security to spring admin

java islessthan method

Java implementation of recursive Binary Search

java round double

java downcasting

range of fibonacci series in java using recursion

java by anyone

solid java

equals() and hashcode() methods in java

android java map to bundle

android start activity with data

medium java 17

java import util list

bean life cycle in spring

spring boot aop

spring aspect

spring logging

simple java jsp project example

spring boot file watcher implementation example

kotlin loop list

autowired spring

java generics example

spring bean scope

appconfig spring

queue java array

create nan variable java

get string enum java

groovy string to array

find the second largest number in an arrya in java