From aea61f207608780f989b904ef452a8cbc40aef4d Mon Sep 17 00:00:00 2001 From: k0rrluna Date: Mon, 13 Jan 2025 03:59:28 +0300 Subject: [PATCH] lab7 --- labs/lab5/Salary.class | Bin 0 -> 1430 bytes labs/lab5/Salary.java | 36 ++++++++++++++++++++++++++++++++++++ labs/lab7/Dog.class | Bin 0 -> 429 bytes labs/lab7/Dog.java | 33 +++++++++++++++++++++++++++++++++ labs/lab7/DogTest.java | 20 ++++++++++++++++++++ labs/lab7/Labrador.class | Bin 0 -> 492 bytes labs/lab7/Labrador.java | 33 +++++++++++++++++++++++++++++++++ labs/lab7/Yorkshire.class | Bin 0 -> 423 bytes labs/lab7/Yorkshire.java | 26 ++++++++++++++++++++++++++ test/Cat.class | Bin 0 -> 589 bytes test/Cat.java | 27 +++++++++++++++++++++++++++ test/CatTest.java | 6 ++++++ test/Orange.class | Bin 0 -> 341 bytes test/Orange.java | 13 +++++++++++++ 14 files changed, 194 insertions(+) create mode 100644 labs/lab5/Salary.class create mode 100644 labs/lab5/Salary.java create mode 100644 labs/lab7/Dog.class create mode 100644 labs/lab7/Dog.java create mode 100644 labs/lab7/DogTest.java create mode 100644 labs/lab7/Labrador.class create mode 100644 labs/lab7/Labrador.java create mode 100644 labs/lab7/Yorkshire.class create mode 100644 labs/lab7/Yorkshire.java create mode 100644 test/Cat.class create mode 100644 test/Cat.java create mode 100644 test/CatTest.java create mode 100644 test/Orange.class create mode 100644 test/Orange.java diff --git a/labs/lab5/Salary.class b/labs/lab5/Salary.class new file mode 100644 index 0000000000000000000000000000000000000000..1c12fde1d2148318f78287b0aff7f70921f26917 GIT binary patch literal 1430 zcmaJ>O>-MX5Pf4=T3KFOmf{cDAZHzv#0peIAbeN~v12)o9qfF`aVo`u8m}kzMynas z?kFHQ0#~k3oT=iLDspgArivfHzu?S~JJ7Q$6Q%6Rs%mz-)$_XF>z?`JpTpk)e1feE z29U5YXd{Uf!`Nf~gjakn_bRt{9t&49q^@|<(^nZ1^W|*|X@*=B)X|<_X}DZU5ey-N zVGFj65sbcq(&&a-v=|0F$uO}I?etV-UA8;Ap##BNwG1qbnfy71!u*LLNM0!xQp4_XIw@tmLZ8(@?$Vl;}UQwMLUqk|}r12KR?92RZ5j;{si%VBH z0oR03byAB@U)=rcyV)11C2E3sQj0%-_2-SJ<6ozi(np@}gdSC5^*%Yp4u!w+*b=%^E@P3l< zQL6Pz-Giue-*0$Y)YABrrvF+?b!b@CBd1Gh(7<@1s5&K<#wO|Z(DdeWO*&`yF@w+P?%1RAuSu3~a0XWi wVFH8yQee`;Vj@8oss-e77QtSNQY{kzFiJ^RNRFG)x`A8d%aDB=chSJ~f9GFg5dZ)H literal 0 HcmV?d00001 diff --git a/labs/lab5/Salary.java b/labs/lab5/Salary.java new file mode 100644 index 0000000..3cc29e9 --- /dev/null +++ b/labs/lab5/Salary.java @@ -0,0 +1,36 @@ +// *************************************************************** +// Salary.java +// Computes the raise and new salary for an employee +// *************************************************************** +import java.util.Scanner; +public class Salary +{ +public static void main (String[] args) +{ +double currentSalary; // current annual salary +double rating; // performance rating +double raise = 0; // dollar amount of the raise +Scanner scan = new Scanner(System.in); +// Get the current salary and performance rating +System.out.print ("Enter the current salary: "); +currentSalary = scan.nextDouble(); +System.out.print ("Enter the performance rating: "); +rating = scan.nextDouble(); +// Compute the raise -- Use if ... else ... + +if (rating == 1) { + raise = currentSalary * 0.06; +} else if (rating == 2) { + raise = currentSalary * 0.04; +} else if (rating == 3) { + raise = currentSalary * 0.015; +} else { + System.out.println("Rating not correctly entered!"); + return; +} + +// Print the results +System.out.println ("Amount of your raise: $" + raise); +System.out.println ("Your new salary: $" + (currentSalary + raise)); +} +} \ No newline at end of file diff --git a/labs/lab7/Dog.class b/labs/lab7/Dog.class new file mode 100644 index 0000000000000000000000000000000000000000..514e9e808eedb00fff25df1f515084320c4ebec1 GIT binary patch literal 429 zcmZWl%}&BV7@X}dR4j;y8pFX`TN8Nze-3I)Ob8w@a9&`oMQBYeJeMXK6AwOs4`rM- z1QWT;e*4YLxAX1y&*v9_GweIipxZDiFkuPQCUPO$QyGWt+u=lwG6Cx}ilgjYK==H9 z86}i$I2CN5!q!z13K+4RDS>+D&)mz>C=O3ba7ho6C0qHceNA6sym+z zReC3fQ+Di7W!++O!}Hg@0_O9Rl8*weT!a^?QsaS&!UslX(i;J%m(0_Vx{mT;B_=)2 z^BIR+LF4j#IbVX6!P-QXSmP}qoAXZa0TCR%!+tH)TSOOnfd^^ zy%};(T;z2!+DI@KS)|ri;>_lk6|8=>sB$D`=yvJxN0gkGDvTAZF{)Xc92L=UpJ6`y Np>FZhI@dH*KLMEASY!YI literal 0 HcmV?d00001 diff --git a/labs/lab7/Labrador.java b/labs/lab7/Labrador.java new file mode 100644 index 0000000..4dc0393 --- /dev/null +++ b/labs/lab7/Labrador.java @@ -0,0 +1,33 @@ +// **************************************************************** +// Labrador.java +// +// A class derived from Dog that holds information about +// a labrador retriever. Overrides Dog speak method and includes +// information about avg weight for this breed. +// +// **************************************************************** +public class Labrador extends Dog +{ +private String color; //black, yellow, or chocolate? +private int breedWeight = 75; + +public Labrador(String name, String color) +{ +super(name); +this.color = color; +} +// ------------------------------------------------------------ +// Big bark -- overrides speak method in Dog +// ------------------------------------------------------------ +public String speak() +{ +return "WOOF"; +} +// ------------------------------------------------------------ +// Returns weight +// ------------------------------------------------------------ +public int avgBreedWeight() +{ +return breedWeight; +} +} \ No newline at end of file diff --git a/labs/lab7/Yorkshire.class b/labs/lab7/Yorkshire.class new file mode 100644 index 0000000000000000000000000000000000000000..066a4304becdd6115c143356ad8d6bac1e8c4b1d GIT binary patch literal 423 zcmZWk%T5A85Ukz>7M6X9pcqfy7Bun!J`Q3`NQf5<#^WI4GJ-p1S>UHU=)stH@B{oP zW3Sn8z{~V>byZjO_s{1SfHUmbFko6JI4Gh-FfVmPD4nWUrRRi3*nbpD(V2-j>I~9E z#nDM?SV0*T3$}wQ975$zC)4>vC6Z7bB~p%8Qbm)LK)o_NLSd!#1HtX;c%F(l9g5jP zn(XiMtgFYY^ZP26*Ndl-Om4(z#z=AgEX9;i4_p5;5InJrE;6s%+{+AGJ%T;Zi{xHj zsceO}4tAVffdkHMuq~mMCFkmMXCQ#df4-mJEk=$Q%Xm)v@B`Ei{C8MyxeoA{4YvUGw;oN+3%mvF96r5<)I;CLAPPR6etbllWdM;IB4GYhrX8xm{&my{8r@at&lQ;+mmx{h=qo}xs7mcDgi!BQ7{ODQWq`s$i4HY9sll;=y{GNm4LeTwZMlun&!}*;Nv`4lumy5@#DX+8X zjEZ-&p`BhrJ{->%<*hllwHN(deOzCKeQtI6C4s8