SlideShare a Scribd company logo
1 of 6
Download to read offline
1.
//Assignment1.java
public class Assignment1 {
public static void main(String[] args) {
//integer variable
int intNumber=15;
//double variable
double doubleNumber=6;
//declare ratio of type double
double ratio;
//Divide the integer by integer yields an integer value
//even the intNumber=15 divided by 6, the result is 2
//since decimal value,0.5 is discarded from 2.5.
ratio=intNumber/6;
System.out.println("intNumber = "+intNumber);
System.out.println("doubleNumber = "+doubleNumber);
//print ratio value ,2 to console
System.out.println("ratio=intNumber/6 = "+ratio);
//Re-assignment
//Divide the integer by double yields an double value
//2.5 is double value stored in a double variable, ratio
ratio=intNumber/doubleNumber;
//print ration to console
System.out.println("ratio=intNumber/doubleNumber="+ratio);
}
}//end of class Assignment1
-------------------------------------------------------------------------------------------------------------------
2.
//Assignment2.java
public class Assignment2 {
public static void main(String[] args) {
//since the ascii values of a =97
//and b=98,a+b=195 is printed
System.out.println('a'+'b');
//double quotation is string
//value and converts the characters
//to string
System.out.println(" "+'a'+'b');
//even double quotation is a string
//the paranthesis separates the character
// values from the string and sum the
//a+b=195 to console
System.out.println(" "+('a'+'b'));
}
}
-------------------------------------------------------------------------------------------------------------------
3.
//Assignment3.java
public class Assignment3 {
public static void main(String[] args) {
//integer variable
int intNumber=15;
//double variable
double doubleNumber=6;
//since the string "These are numbers: " will not sum the values
//intNumber and doubleNumber so they print as individual values along with string
System.out.println("These are numbers: " + intNumber + doubleNumber);
//here intNumber and doubleNumber are separatead by paranthesis
//so they become added up and print the result to console.
System.out.println("These are numbers: " + (intNumber + doubleNumber));
}
}
----------------------------------------------------------------------------------------------------------------
4.
//Assignment4.java
public class Assignment4 {
public static void main(String[] args) {
//integer variable
int intNumber=15;
//double variable
double doubleNumber=6;
// in the paranthesis, the multiplucation got prioority over / and +
//intNumber*doubleNumber=90.0, then 5/90=0.05, .05 is dicarded
//25+0+1=26 will be printed
System.out.println("Formula1: " + (25 +5/intNumber*doubleNumber + 1));
//Preference of parenthesis from right to left
//(doubleNumber+1)=6+1=7
//(25+5)=30
// The division operator gets percedence from left to right
// then * got precedence
//30/15*(6+1)=30/15*7=2*7=14
System.out.println(((25+5)/intNumber*(doubleNumber + 1)));
}
}
Solution
1.
//Assignment1.java
public class Assignment1 {
public static void main(String[] args) {
//integer variable
int intNumber=15;
//double variable
double doubleNumber=6;
//declare ratio of type double
double ratio;
//Divide the integer by integer yields an integer value
//even the intNumber=15 divided by 6, the result is 2
//since decimal value,0.5 is discarded from 2.5.
ratio=intNumber/6;
System.out.println("intNumber = "+intNumber);
System.out.println("doubleNumber = "+doubleNumber);
//print ratio value ,2 to console
System.out.println("ratio=intNumber/6 = "+ratio);
//Re-assignment
//Divide the integer by double yields an double value
//2.5 is double value stored in a double variable, ratio
ratio=intNumber/doubleNumber;
//print ration to console
System.out.println("ratio=intNumber/doubleNumber="+ratio);
}
}//end of class Assignment1
-------------------------------------------------------------------------------------------------------------------
2.
//Assignment2.java
public class Assignment2 {
public static void main(String[] args) {
//since the ascii values of a =97
//and b=98,a+b=195 is printed
System.out.println('a'+'b');
//double quotation is string
//value and converts the characters
//to string
System.out.println(" "+'a'+'b');
//even double quotation is a string
//the paranthesis separates the character
// values from the string and sum the
//a+b=195 to console
System.out.println(" "+('a'+'b'));
}
}
-------------------------------------------------------------------------------------------------------------------
3.
//Assignment3.java
public class Assignment3 {
public static void main(String[] args) {
//integer variable
int intNumber=15;
//double variable
double doubleNumber=6;
//since the string "These are numbers: " will not sum the values
//intNumber and doubleNumber so they print as individual values along with string
System.out.println("These are numbers: " + intNumber + doubleNumber);
//here intNumber and doubleNumber are separatead by paranthesis
//so they become added up and print the result to console.
System.out.println("These are numbers: " + (intNumber + doubleNumber));
}
}
----------------------------------------------------------------------------------------------------------------
4.
//Assignment4.java
public class Assignment4 {
public static void main(String[] args) {
//integer variable
int intNumber=15;
//double variable
double doubleNumber=6;
// in the paranthesis, the multiplucation got prioority over / and +
//intNumber*doubleNumber=90.0, then 5/90=0.05, .05 is dicarded
//25+0+1=26 will be printed
System.out.println("Formula1: " + (25 +5/intNumber*doubleNumber + 1));
//Preference of parenthesis from right to left
//(doubleNumber+1)=6+1=7
//(25+5)=30
// The division operator gets percedence from left to right
// then * got precedence
//30/15*(6+1)=30/15*7=2*7=14
System.out.println(((25+5)/intNumber*(doubleNumber + 1)));
}
}

More Related Content

Similar to 1. Assignment1.java public class Assignment1 {    public sta.pdf

week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxweek3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxalanfhall8953
 
Lecture#5 Operators in C++
Lecture#5 Operators in C++Lecture#5 Operators in C++
Lecture#5 Operators in C++NUST Stuff
 
Cmis 212 module 2 assignment
Cmis 212 module 2 assignmentCmis 212 module 2 assignment
Cmis 212 module 2 assignmentzjkdg986
 
Cmis 212 module 2 assignment
Cmis 212 module 2 assignmentCmis 212 module 2 assignment
Cmis 212 module 2 assignmentfdjfjfy4498
 
Cmis 212 module 2 assignment
Cmis 212 module 2 assignmentCmis 212 module 2 assignment
Cmis 212 module 2 assignmentsdfgsdg36
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersSheila Sinclair
 
Csphtp1 04
Csphtp1 04Csphtp1 04
Csphtp1 04HUST
 
Python programing
Python programingPython programing
Python programinghamzagame
 
4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладкаDEVTYPE
 
Powerpoint presentation final requirement in fnd prg
Powerpoint presentation final requirement in fnd prgPowerpoint presentation final requirement in fnd prg
Powerpoint presentation final requirement in fnd prgalyssa-castro2326
 
This project calls for the modification of the DollarFormat clas.pdf
This project calls for the modification of the DollarFormat clas.pdfThis project calls for the modification of the DollarFormat clas.pdf
This project calls for the modification of the DollarFormat clas.pdfjibinsh
 
public class Point {   Insert your name here    private dou.pdf
public class Point {    Insert your name here    private dou.pdfpublic class Point {    Insert your name here    private dou.pdf
public class Point {   Insert your name here    private dou.pdfanandshingavi23
 
Programming basics
Programming basicsProgramming basics
Programming basicsillidari
 
DeVry GSP 115 Week 3 Assignment latest
DeVry GSP 115 Week 3 Assignment latestDeVry GSP 115 Week 3 Assignment latest
DeVry GSP 115 Week 3 Assignment latestAtifkhilji
 
4. programing 101
4. programing 1014. programing 101
4. programing 101IEEE MIU SB
 

Similar to 1. Assignment1.java public class Assignment1 {    public sta.pdf (20)

week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxweek3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
 
Lecture#5 Operators in C++
Lecture#5 Operators in C++Lecture#5 Operators in C++
Lecture#5 Operators in C++
 
Cmis 212 module 2 assignment
Cmis 212 module 2 assignmentCmis 212 module 2 assignment
Cmis 212 module 2 assignment
 
Cmis 212 module 2 assignment
Cmis 212 module 2 assignmentCmis 212 module 2 assignment
Cmis 212 module 2 assignment
 
Cmis 212 module 2 assignment
Cmis 212 module 2 assignmentCmis 212 module 2 assignment
Cmis 212 module 2 assignment
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
 
Csphtp1 04
Csphtp1 04Csphtp1 04
Csphtp1 04
 
Kotlin
KotlinKotlin
Kotlin
 
Python programing
Python programingPython programing
Python programing
 
4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка4. Обработка ошибок, исключения, отладка
4. Обработка ошибок, исключения, отладка
 
Powerpoint presentation final requirement in fnd prg
Powerpoint presentation final requirement in fnd prgPowerpoint presentation final requirement in fnd prg
Powerpoint presentation final requirement in fnd prg
 
This project calls for the modification of the DollarFormat clas.pdf
This project calls for the modification of the DollarFormat clas.pdfThis project calls for the modification of the DollarFormat clas.pdf
This project calls for the modification of the DollarFormat clas.pdf
 
public class Point {   Insert your name here    private dou.pdf
public class Point {    Insert your name here    private dou.pdfpublic class Point {    Insert your name here    private dou.pdf
public class Point {   Insert your name here    private dou.pdf
 
Prog1-L3.pptx
Prog1-L3.pptxProg1-L3.pptx
Prog1-L3.pptx
 
Programming basics
Programming basicsProgramming basics
Programming basics
 
DeVry GSP 115 Week 3 Assignment latest
DeVry GSP 115 Week 3 Assignment latestDeVry GSP 115 Week 3 Assignment latest
DeVry GSP 115 Week 3 Assignment latest
 
03-fortran.ppt
03-fortran.ppt03-fortran.ppt
03-fortran.ppt
 
4. programing 101
4. programing 1014. programing 101
4. programing 101
 
pythonQuick.pdf
pythonQuick.pdfpythonQuick.pdf
pythonQuick.pdf
 
python notes.pdf
python notes.pdfpython notes.pdf
python notes.pdf
 

More from rakeshankur

1]Resistance is a ability to ward off diseases, It involves a netw.pdf
1]Resistance is a ability to ward off diseases, It involves a netw.pdf1]Resistance is a ability to ward off diseases, It involves a netw.pdf
1]Resistance is a ability to ward off diseases, It involves a netw.pdfrakeshankur
 
1.If we want to add a new Crow class,first of all we have to observe.pdf
1.If we want to add a new Crow class,first of all we have to observe.pdf1.If we want to add a new Crow class,first of all we have to observe.pdf
1.If we want to add a new Crow class,first of all we have to observe.pdfrakeshankur
 
1. Sherwood Anderson known for his bestseller  Dark Laughter2.Thei.pdf
1. Sherwood Anderson known for his bestseller  Dark Laughter2.Thei.pdf1. Sherwood Anderson known for his bestseller  Dark Laughter2.Thei.pdf
1. Sherwood Anderson known for his bestseller  Dark Laughter2.Thei.pdfrakeshankur
 
(41)B. Mitochondria - cellular respiration(42)B. adhesive junc.pdf
(41)B. Mitochondria - cellular respiration(42)B. adhesive junc.pdf(41)B. Mitochondria - cellular respiration(42)B. adhesive junc.pdf
(41)B. Mitochondria - cellular respiration(42)B. adhesive junc.pdfrakeshankur
 
The electrons which are involved in bond formatio.pdf
                     The electrons which are involved in bond formatio.pdf                     The electrons which are involved in bond formatio.pdf
The electrons which are involved in bond formatio.pdfrakeshankur
 
Methylene blue is polar so a non polar mobile pha.pdf
                     Methylene blue is polar so a non polar mobile pha.pdf                     Methylene blue is polar so a non polar mobile pha.pdf
Methylene blue is polar so a non polar mobile pha.pdfrakeshankur
 
KCl NH3 Ar note KCl is ionic solid, has a v.pdf
                     KCl  NH3  Ar  note KCl is ionic solid, has a v.pdf                     KCl  NH3  Ar  note KCl is ionic solid, has a v.pdf
KCl NH3 Ar note KCl is ionic solid, has a v.pdfrakeshankur
 
Parameters, like population mean and population stadard deviation..pdf
Parameters, like population mean and population stadard deviation..pdfParameters, like population mean and population stadard deviation..pdf
Parameters, like population mean and population stadard deviation..pdfrakeshankur
 
b.glucose, HOCl, NaCl, MgCl2 increase in ionic ch.pdf
                     b.glucose, HOCl, NaCl, MgCl2 increase in ionic ch.pdf                     b.glucose, HOCl, NaCl, MgCl2 increase in ionic ch.pdf
b.glucose, HOCl, NaCl, MgCl2 increase in ionic ch.pdfrakeshankur
 
The periodic table of the chemical elements (also known as the perio.pdf
The periodic table of the chemical elements (also known as the perio.pdfThe periodic table of the chemical elements (also known as the perio.pdf
The periodic table of the chemical elements (also known as the perio.pdfrakeshankur
 
The answer is c, Polonium. An alpha particle contains two protons .pdf
The answer is c, Polonium. An alpha particle contains two protons .pdfThe answer is c, Polonium. An alpha particle contains two protons .pdf
The answer is c, Polonium. An alpha particle contains two protons .pdfrakeshankur
 
Solutionclass IntNode { int data; public IntNode next,head;.pdf
Solutionclass IntNode { int data; public IntNode next,head;.pdfSolutionclass IntNode { int data; public IntNode next,head;.pdf
Solutionclass IntNode { int data; public IntNode next,head;.pdfrakeshankur
 
Answer is I, II, and V (5) .pdf
                     Answer is I, II, and V (5)                       .pdf                     Answer is I, II, and V (5)                       .pdf
Answer is I, II, and V (5) .pdfrakeshankur
 
Medical importance of bacteriaEcological importance of bacteria.pdf
Medical importance of bacteriaEcological importance of bacteria.pdfMedical importance of bacteriaEcological importance of bacteria.pdf
Medical importance of bacteriaEcological importance of bacteria.pdfrakeshankur
 
import turtleimport timeimport randomdef draw_rectangle(length.pdf
import turtleimport timeimport randomdef draw_rectangle(length.pdfimport turtleimport timeimport randomdef draw_rectangle(length.pdf
import turtleimport timeimport randomdef draw_rectangle(length.pdfrakeshankur
 
Effects of NaCl Concentration on Red Blood Cell Volume A red blo.pdf
Effects of NaCl Concentration on Red Blood Cell Volume A red blo.pdfEffects of NaCl Concentration on Red Blood Cell Volume A red blo.pdf
Effects of NaCl Concentration on Red Blood Cell Volume A red blo.pdfrakeshankur
 
C) 0.3275SolutionC) 0.3275.pdf
C) 0.3275SolutionC) 0.3275.pdfC) 0.3275SolutionC) 0.3275.pdf
C) 0.3275SolutionC) 0.3275.pdfrakeshankur
 
ass smokeSolutionass smoke.pdf
ass smokeSolutionass smoke.pdfass smokeSolutionass smoke.pdf
ass smokeSolutionass smoke.pdfrakeshankur
 
Answer-Possible types of audit for this project1. Financial au.pdf
Answer-Possible types of audit for this project1. Financial au.pdfAnswer-Possible types of audit for this project1. Financial au.pdf
Answer-Possible types of audit for this project1. Financial au.pdfrakeshankur
 
4 1 2 3 Solution 4 1 2 3.pdf
                     4 1 2 3  Solution                     4 1 2 3.pdf                     4 1 2 3  Solution                     4 1 2 3.pdf
4 1 2 3 Solution 4 1 2 3.pdfrakeshankur
 

More from rakeshankur (20)

1]Resistance is a ability to ward off diseases, It involves a netw.pdf
1]Resistance is a ability to ward off diseases, It involves a netw.pdf1]Resistance is a ability to ward off diseases, It involves a netw.pdf
1]Resistance is a ability to ward off diseases, It involves a netw.pdf
 
1.If we want to add a new Crow class,first of all we have to observe.pdf
1.If we want to add a new Crow class,first of all we have to observe.pdf1.If we want to add a new Crow class,first of all we have to observe.pdf
1.If we want to add a new Crow class,first of all we have to observe.pdf
 
1. Sherwood Anderson known for his bestseller  Dark Laughter2.Thei.pdf
1. Sherwood Anderson known for his bestseller  Dark Laughter2.Thei.pdf1. Sherwood Anderson known for his bestseller  Dark Laughter2.Thei.pdf
1. Sherwood Anderson known for his bestseller  Dark Laughter2.Thei.pdf
 
(41)B. Mitochondria - cellular respiration(42)B. adhesive junc.pdf
(41)B. Mitochondria - cellular respiration(42)B. adhesive junc.pdf(41)B. Mitochondria - cellular respiration(42)B. adhesive junc.pdf
(41)B. Mitochondria - cellular respiration(42)B. adhesive junc.pdf
 
The electrons which are involved in bond formatio.pdf
                     The electrons which are involved in bond formatio.pdf                     The electrons which are involved in bond formatio.pdf
The electrons which are involved in bond formatio.pdf
 
Methylene blue is polar so a non polar mobile pha.pdf
                     Methylene blue is polar so a non polar mobile pha.pdf                     Methylene blue is polar so a non polar mobile pha.pdf
Methylene blue is polar so a non polar mobile pha.pdf
 
KCl NH3 Ar note KCl is ionic solid, has a v.pdf
                     KCl  NH3  Ar  note KCl is ionic solid, has a v.pdf                     KCl  NH3  Ar  note KCl is ionic solid, has a v.pdf
KCl NH3 Ar note KCl is ionic solid, has a v.pdf
 
Parameters, like population mean and population stadard deviation..pdf
Parameters, like population mean and population stadard deviation..pdfParameters, like population mean and population stadard deviation..pdf
Parameters, like population mean and population stadard deviation..pdf
 
b.glucose, HOCl, NaCl, MgCl2 increase in ionic ch.pdf
                     b.glucose, HOCl, NaCl, MgCl2 increase in ionic ch.pdf                     b.glucose, HOCl, NaCl, MgCl2 increase in ionic ch.pdf
b.glucose, HOCl, NaCl, MgCl2 increase in ionic ch.pdf
 
The periodic table of the chemical elements (also known as the perio.pdf
The periodic table of the chemical elements (also known as the perio.pdfThe periodic table of the chemical elements (also known as the perio.pdf
The periodic table of the chemical elements (also known as the perio.pdf
 
The answer is c, Polonium. An alpha particle contains two protons .pdf
The answer is c, Polonium. An alpha particle contains two protons .pdfThe answer is c, Polonium. An alpha particle contains two protons .pdf
The answer is c, Polonium. An alpha particle contains two protons .pdf
 
Solutionclass IntNode { int data; public IntNode next,head;.pdf
Solutionclass IntNode { int data; public IntNode next,head;.pdfSolutionclass IntNode { int data; public IntNode next,head;.pdf
Solutionclass IntNode { int data; public IntNode next,head;.pdf
 
Answer is I, II, and V (5) .pdf
                     Answer is I, II, and V (5)                       .pdf                     Answer is I, II, and V (5)                       .pdf
Answer is I, II, and V (5) .pdf
 
Medical importance of bacteriaEcological importance of bacteria.pdf
Medical importance of bacteriaEcological importance of bacteria.pdfMedical importance of bacteriaEcological importance of bacteria.pdf
Medical importance of bacteriaEcological importance of bacteria.pdf
 
import turtleimport timeimport randomdef draw_rectangle(length.pdf
import turtleimport timeimport randomdef draw_rectangle(length.pdfimport turtleimport timeimport randomdef draw_rectangle(length.pdf
import turtleimport timeimport randomdef draw_rectangle(length.pdf
 
Effects of NaCl Concentration on Red Blood Cell Volume A red blo.pdf
Effects of NaCl Concentration on Red Blood Cell Volume A red blo.pdfEffects of NaCl Concentration on Red Blood Cell Volume A red blo.pdf
Effects of NaCl Concentration on Red Blood Cell Volume A red blo.pdf
 
C) 0.3275SolutionC) 0.3275.pdf
C) 0.3275SolutionC) 0.3275.pdfC) 0.3275SolutionC) 0.3275.pdf
C) 0.3275SolutionC) 0.3275.pdf
 
ass smokeSolutionass smoke.pdf
ass smokeSolutionass smoke.pdfass smokeSolutionass smoke.pdf
ass smokeSolutionass smoke.pdf
 
Answer-Possible types of audit for this project1. Financial au.pdf
Answer-Possible types of audit for this project1. Financial au.pdfAnswer-Possible types of audit for this project1. Financial au.pdf
Answer-Possible types of audit for this project1. Financial au.pdf
 
4 1 2 3 Solution 4 1 2 3.pdf
                     4 1 2 3  Solution                     4 1 2 3.pdf                     4 1 2 3  Solution                     4 1 2 3.pdf
4 1 2 3 Solution 4 1 2 3.pdf
 

Recently uploaded

Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 

Recently uploaded (20)

Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 

1. Assignment1.java public class Assignment1 {    public sta.pdf

  • 1. 1. //Assignment1.java public class Assignment1 { public static void main(String[] args) { //integer variable int intNumber=15; //double variable double doubleNumber=6; //declare ratio of type double double ratio; //Divide the integer by integer yields an integer value //even the intNumber=15 divided by 6, the result is 2 //since decimal value,0.5 is discarded from 2.5. ratio=intNumber/6; System.out.println("intNumber = "+intNumber); System.out.println("doubleNumber = "+doubleNumber); //print ratio value ,2 to console System.out.println("ratio=intNumber/6 = "+ratio); //Re-assignment //Divide the integer by double yields an double value //2.5 is double value stored in a double variable, ratio ratio=intNumber/doubleNumber; //print ration to console System.out.println("ratio=intNumber/doubleNumber="+ratio); } }//end of class Assignment1 ------------------------------------------------------------------------------------------------------------------- 2. //Assignment2.java public class Assignment2 { public static void main(String[] args) { //since the ascii values of a =97
  • 2. //and b=98,a+b=195 is printed System.out.println('a'+'b'); //double quotation is string //value and converts the characters //to string System.out.println(" "+'a'+'b'); //even double quotation is a string //the paranthesis separates the character // values from the string and sum the //a+b=195 to console System.out.println(" "+('a'+'b')); } } ------------------------------------------------------------------------------------------------------------------- 3. //Assignment3.java public class Assignment3 { public static void main(String[] args) { //integer variable int intNumber=15; //double variable double doubleNumber=6; //since the string "These are numbers: " will not sum the values //intNumber and doubleNumber so they print as individual values along with string System.out.println("These are numbers: " + intNumber + doubleNumber); //here intNumber and doubleNumber are separatead by paranthesis //so they become added up and print the result to console. System.out.println("These are numbers: " + (intNumber + doubleNumber)); } } ---------------------------------------------------------------------------------------------------------------- 4. //Assignment4.java public class Assignment4 {
  • 3. public static void main(String[] args) { //integer variable int intNumber=15; //double variable double doubleNumber=6; // in the paranthesis, the multiplucation got prioority over / and + //intNumber*doubleNumber=90.0, then 5/90=0.05, .05 is dicarded //25+0+1=26 will be printed System.out.println("Formula1: " + (25 +5/intNumber*doubleNumber + 1)); //Preference of parenthesis from right to left //(doubleNumber+1)=6+1=7 //(25+5)=30 // The division operator gets percedence from left to right // then * got precedence //30/15*(6+1)=30/15*7=2*7=14 System.out.println(((25+5)/intNumber*(doubleNumber + 1))); } } Solution 1. //Assignment1.java public class Assignment1 { public static void main(String[] args) { //integer variable int intNumber=15; //double variable double doubleNumber=6; //declare ratio of type double double ratio; //Divide the integer by integer yields an integer value //even the intNumber=15 divided by 6, the result is 2 //since decimal value,0.5 is discarded from 2.5.
  • 4. ratio=intNumber/6; System.out.println("intNumber = "+intNumber); System.out.println("doubleNumber = "+doubleNumber); //print ratio value ,2 to console System.out.println("ratio=intNumber/6 = "+ratio); //Re-assignment //Divide the integer by double yields an double value //2.5 is double value stored in a double variable, ratio ratio=intNumber/doubleNumber; //print ration to console System.out.println("ratio=intNumber/doubleNumber="+ratio); } }//end of class Assignment1 ------------------------------------------------------------------------------------------------------------------- 2. //Assignment2.java public class Assignment2 { public static void main(String[] args) { //since the ascii values of a =97 //and b=98,a+b=195 is printed System.out.println('a'+'b'); //double quotation is string //value and converts the characters //to string System.out.println(" "+'a'+'b'); //even double quotation is a string //the paranthesis separates the character // values from the string and sum the //a+b=195 to console System.out.println(" "+('a'+'b')); } } -------------------------------------------------------------------------------------------------------------------
  • 5. 3. //Assignment3.java public class Assignment3 { public static void main(String[] args) { //integer variable int intNumber=15; //double variable double doubleNumber=6; //since the string "These are numbers: " will not sum the values //intNumber and doubleNumber so they print as individual values along with string System.out.println("These are numbers: " + intNumber + doubleNumber); //here intNumber and doubleNumber are separatead by paranthesis //so they become added up and print the result to console. System.out.println("These are numbers: " + (intNumber + doubleNumber)); } } ---------------------------------------------------------------------------------------------------------------- 4. //Assignment4.java public class Assignment4 { public static void main(String[] args) { //integer variable int intNumber=15; //double variable double doubleNumber=6; // in the paranthesis, the multiplucation got prioority over / and + //intNumber*doubleNumber=90.0, then 5/90=0.05, .05 is dicarded //25+0+1=26 will be printed System.out.println("Formula1: " + (25 +5/intNumber*doubleNumber + 1)); //Preference of parenthesis from right to left //(doubleNumber+1)=6+1=7 //(25+5)=30 // The division operator gets percedence from left to right // then * got precedence