SlideShare a Scribd company logo
1 of 8
Project 2/Project 2.pdf
Introduction to Programming EECS 1500
Project 2 Elementary Aspects of C++
100 Points - Due Thursday February 11 in class
The revision is for part a on Modulo division
Note: These projects should be completed by February 4. They
are all formally due in class, on
Thursday February 11. This later date is only given to help
students who enroll late for the class.
a. Modulo Division Write a program to read in a 3-digit
integer and print out the sum of the digits of
the integer. Use the % operator to extrct the digits and use the /
operator to extract the digit. Use the
following format for input/output:
Enter an integer: 744
The sum of the digits is: 15
b. Approximating Pi Pi can be computed using the formula
4 * (1.0 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - . . .)
Write a program to display the result of
4 * (1.0 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13)
Note: be sure to use 1.0 not 1 in your program.
c. Wind Chill The National Weather Service has a relatively
new formula to measure the wind chill
temperature. The formula is
Wind Chill = 35.74 + 0.6215T - 35.75V0.16 + 0.4275TV0.16
where T = outside temperature (°F) and V = wind velocity
(mph). The formula cannot be used for
wind speeds below 2 mph, temperatures below -58°F, or
temperatures above 41°F.
Write a program that prompts the user to enter a temperature
and a wind speed, and then displays the
wind chill temperature. You may assume the values entered are
valid.
Enter temperature(Fahrenheit): 5.3
Enter wind speed(mph): 6
The wind chill index is -5
d. Distance Given the two points (x1, y1) and (x2, y2), the
distance between these points is given
by the formula:
Write a program that prompts the user to enter the two points,
and then displays the distance between
them. You may assume the values entered are valid. For
example,
Enter x1 and y1: 1.0 5
Enter x2 and y2: -2.0 1
The distance is 5.0
Project 2/quiz1.txt
package splitter;
import java.util.Scanner;
public class Split {
public static void main(String[] args)
{
int i = 234;
sumDigits(i);
}
private static void sumDigits(int digits)
{
System.out.println("digits before calculation: " + digits);
int sum = 0;
while ( digits > 0 )
{
sum += digits % 10;
digits /= 10;
System.out.println("sum: " + sum);
System.out.println("digits after calculation: " + digits);
}
}
}
Project 2/quiz2.txt
package pi;
public class Pi {
public static void main(String[] args) {
double pi;
pi=4*((1.0+1/5+1/9+1/13)-(1/3+1/11+1/7));
System.out.print("The Pi is :" +pi);
}
}
Project 2/quiz3.txt
package temperature;
import java.util.Scanner;
public class Temperature {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter temperature in Farehneit ");
int t = scan.nextInt();
System.out.print("Enter wind Velocity (in MPH) ");
int v = scan.nextInt();
if (v>2){
if (t>-58 && t<41){
double WindChill = 35.74+0.6215*t+
Math.pow(0.4275*v,0.16)-Math.pow(35.74*v, 0.16);
System.out.print("The temperature is :"+WindChill);
}
else{
System.out.print("Check the extreme values of
temperature");
}
}
else{
System.out.print("Wind speed cannot be less than 2
mph");
}
}
}
Project 2/quiz4.txt
package distance;
import java.util.Scanner;
public class Distance {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter x1 and y1");
double x1 = scan.nextInt();
double y1 = scan.nextInt();
System.out.print("Enter x2 and y2");
double x2 = scan.nextInt();
double y2 = scan.nextInt();
double d = Math.sqrt(Math.pow((x2-x1), 2)+Math.pow((y2-
y1), 2));
System.out.print("The distance is "+d) ;
}
}
Project 2Project 2.pdfIntroduction to Programming  EECS 1.docx

More Related Content

Similar to Project 2Project 2.pdfIntroduction to Programming EECS 1.docx

Lec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdfLec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdfShwetaSaharan8
 
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docxSpring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docxrafbolet0
 
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchComputer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchSAKSHIGAWADE2
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy BookAbir Hossain
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 manjurkts
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17manjurkts
 
c++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfc++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfayush616992
 
Unit3 overview of_c_programming
Unit3 overview of_c_programmingUnit3 overview of_c_programming
Unit3 overview of_c_programmingCapuchino HuiNing
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CPrabu U
 
Basic Programming concepts - Programming with C++
Basic Programming concepts - Programming with C++Basic Programming concepts - Programming with C++
Basic Programming concepts - Programming with C++Mohamed El Desouki
 
DSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfDSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfROWELL MARQUINA
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEWshyamuopeight
 
Python programming workshop session 4
Python programming workshop session 4Python programming workshop session 4
Python programming workshop session 4Abdul Haseeb
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10alish sha
 
Labsheet1 stud
Labsheet1 studLabsheet1 stud
Labsheet1 studrohassanie
 

Similar to Project 2Project 2.pdfIntroduction to Programming EECS 1.docx (20)

Lec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdfLec1_EENG112-Introduction.pdf
Lec1_EENG112-Introduction.pdf
 
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docxSpring 2014 CSCI 111 Final exam   of 1 61. (2 points) Fl.docx
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docx
 
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branchComputer experiments   1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
 
Important C program of Balagurusamy Book
Important C program of Balagurusamy BookImportant C program of Balagurusamy Book
Important C program of Balagurusamy Book
 
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17 CBCS 2018 Scheme I sem Lab Manual for 18CPL17
CBCS 2018 Scheme I sem Lab Manual for 18CPL17
 
C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17C Programming Lab manual 18CPL17
C Programming Lab manual 18CPL17
 
C++
C++C++
C++
 
c++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdfc++ exp 1 Suraj...pdf
c++ exp 1 Suraj...pdf
 
Programming Fundamental handouts
Programming Fundamental handoutsProgramming Fundamental handouts
Programming Fundamental handouts
 
Unit3 overview of_c_programming
Unit3 overview of_c_programmingUnit3 overview of_c_programming
Unit3 overview of_c_programming
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
 
2012 bcsl-021 solve assihnment
2012 bcsl-021 solve assihnment2012 bcsl-021 solve assihnment
2012 bcsl-021 solve assihnment
 
Basic Programming concepts - Programming with C++
Basic Programming concepts - Programming with C++Basic Programming concepts - Programming with C++
Basic Programming concepts - Programming with C++
 
DSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdfDSA Lesson 2 - Algorithm and Flowcharting.pdf
DSA Lesson 2 - Algorithm and Flowcharting.pdf
 
I PUC CS Lab_programs
I PUC CS Lab_programsI PUC CS Lab_programs
I PUC CS Lab_programs
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEW
 
Python programming workshop session 4
Python programming workshop session 4Python programming workshop session 4
Python programming workshop session 4
 
Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10Bti1022 lab sheet 9 10
Bti1022 lab sheet 9 10
 
Labsheet1 stud
Labsheet1 studLabsheet1 stud
Labsheet1 stud
 
CHAPTER 1
CHAPTER 1CHAPTER 1
CHAPTER 1
 

More from wkyra78

Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docxMelissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docxwkyra78
 
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docxMelissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docxwkyra78
 
Meiner, S. E., & Yeager, J. J. (2019). Chapter 17Chap.docx
Meiner, S. E., & Yeager, J. J. (2019).    Chapter 17Chap.docxMeiner, S. E., & Yeager, J. J. (2019).    Chapter 17Chap.docx
Meiner, S. E., & Yeager, J. J. (2019). Chapter 17Chap.docxwkyra78
 
member is a security software architect in a cloud service provider .docx
member is a security software architect in a cloud service provider .docxmember is a security software architect in a cloud service provider .docx
member is a security software architect in a cloud service provider .docxwkyra78
 
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docxMelissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docxwkyra78
 
Melissa is a 15-year-old high school student. Over the last week.docx
Melissa is a 15-year-old high school student. Over the last week.docxMelissa is a 15-year-old high school student. Over the last week.docx
Melissa is a 15-year-old high school student. Over the last week.docxwkyra78
 
Measurement  of  the  angle  θ          .docx
Measurement  of  the  angle  θ          .docxMeasurement  of  the  angle  θ          .docx
Measurement  of  the  angle  θ          .docxwkyra78
 
Measurement of the angle θ For better understanding .docx
Measurement of the angle θ     For better understanding .docxMeasurement of the angle θ     For better understanding .docx
Measurement of the angle θ For better understanding .docxwkyra78
 
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docxMeaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docxwkyra78
 
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docxMBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docxwkyra78
 
Medication Errors Led to Disastrous Outcomes1. Search th.docx
Medication Errors Led to Disastrous Outcomes1. Search th.docxMedication Errors Led to Disastrous Outcomes1. Search th.docx
Medication Errors Led to Disastrous Outcomes1. Search th.docxwkyra78
 
Meet, call, Skype or Zoom with a retired athlete and interview himh.docx
Meet, call, Skype or Zoom with a retired athlete and interview himh.docxMeet, call, Skype or Zoom with a retired athlete and interview himh.docx
Meet, call, Skype or Zoom with a retired athlete and interview himh.docxwkyra78
 
Medication Administration Make a list of the most common med.docx
Medication Administration Make a list of the most common med.docxMedication Administration Make a list of the most common med.docx
Medication Administration Make a list of the most common med.docxwkyra78
 
media portfolio”about chapter 1 to 15 from the book  Ci.docx
media portfolio”about chapter 1 to 15 from the book  Ci.docxmedia portfolio”about chapter 1 to 15 from the book  Ci.docx
media portfolio”about chapter 1 to 15 from the book  Ci.docxwkyra78
 
MediationNameAMUDate.docx
MediationNameAMUDate.docxMediationNameAMUDate.docx
MediationNameAMUDate.docxwkyra78
 
Media coverage influences the publics perception of the crimina.docx
Media coverage influences the publics perception of the crimina.docxMedia coverage influences the publics perception of the crimina.docx
Media coverage influences the publics perception of the crimina.docxwkyra78
 
Media Content AnalysisPurpose Evaluate the quality and value of.docx
Media Content AnalysisPurpose Evaluate the quality and value of.docxMedia Content AnalysisPurpose Evaluate the quality and value of.docx
Media Content AnalysisPurpose Evaluate the quality and value of.docxwkyra78
 
Mayan gods and goddesses are very much a part of this text.  Their i.docx
Mayan gods and goddesses are very much a part of this text.  Their i.docxMayan gods and goddesses are very much a part of this text.  Their i.docx
Mayan gods and goddesses are very much a part of this text.  Their i.docxwkyra78
 
Media and SocietyIn 1,100 words, complete the followingAn.docx
Media and SocietyIn 1,100 words, complete the followingAn.docxMedia and SocietyIn 1,100 words, complete the followingAn.docx
Media and SocietyIn 1,100 words, complete the followingAn.docxwkyra78
 
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docxMBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docxwkyra78
 

More from wkyra78 (20)

Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docxMelissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
Melissa HinkhouseWeek 3-Original PostNURS 6050 Policy and A.docx
 
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docxMelissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
Melissa HinkhouseAdvanced Pharmacology NURS-6521N-43Professo.docx
 
Meiner, S. E., & Yeager, J. J. (2019). Chapter 17Chap.docx
Meiner, S. E., & Yeager, J. J. (2019).    Chapter 17Chap.docxMeiner, S. E., & Yeager, J. J. (2019).    Chapter 17Chap.docx
Meiner, S. E., & Yeager, J. J. (2019). Chapter 17Chap.docx
 
member is a security software architect in a cloud service provider .docx
member is a security software architect in a cloud service provider .docxmember is a security software architect in a cloud service provider .docx
member is a security software architect in a cloud service provider .docx
 
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docxMelissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
Melissa ShortridgeWeek 6COLLAPSEMy own attitude has ch.docx
 
Melissa is a 15-year-old high school student. Over the last week.docx
Melissa is a 15-year-old high school student. Over the last week.docxMelissa is a 15-year-old high school student. Over the last week.docx
Melissa is a 15-year-old high school student. Over the last week.docx
 
Measurement  of  the  angle  θ          .docx
Measurement  of  the  angle  θ          .docxMeasurement  of  the  angle  θ          .docx
Measurement  of  the  angle  θ          .docx
 
Measurement of the angle θ For better understanding .docx
Measurement of the angle θ     For better understanding .docxMeasurement of the angle θ     For better understanding .docx
Measurement of the angle θ For better understanding .docx
 
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docxMeaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
Meaning-Making Forum 2 (Week 5)Meaning-Making Forums 1-4 are thi.docx
 
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docxMBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
MBA6231 - 1.1 - project charter.docxProject Charter Pr.docx
 
Medication Errors Led to Disastrous Outcomes1. Search th.docx
Medication Errors Led to Disastrous Outcomes1. Search th.docxMedication Errors Led to Disastrous Outcomes1. Search th.docx
Medication Errors Led to Disastrous Outcomes1. Search th.docx
 
Meet, call, Skype or Zoom with a retired athlete and interview himh.docx
Meet, call, Skype or Zoom with a retired athlete and interview himh.docxMeet, call, Skype or Zoom with a retired athlete and interview himh.docx
Meet, call, Skype or Zoom with a retired athlete and interview himh.docx
 
Medication Administration Make a list of the most common med.docx
Medication Administration Make a list of the most common med.docxMedication Administration Make a list of the most common med.docx
Medication Administration Make a list of the most common med.docx
 
media portfolio”about chapter 1 to 15 from the book  Ci.docx
media portfolio”about chapter 1 to 15 from the book  Ci.docxmedia portfolio”about chapter 1 to 15 from the book  Ci.docx
media portfolio”about chapter 1 to 15 from the book  Ci.docx
 
MediationNameAMUDate.docx
MediationNameAMUDate.docxMediationNameAMUDate.docx
MediationNameAMUDate.docx
 
Media coverage influences the publics perception of the crimina.docx
Media coverage influences the publics perception of the crimina.docxMedia coverage influences the publics perception of the crimina.docx
Media coverage influences the publics perception of the crimina.docx
 
Media Content AnalysisPurpose Evaluate the quality and value of.docx
Media Content AnalysisPurpose Evaluate the quality and value of.docxMedia Content AnalysisPurpose Evaluate the quality and value of.docx
Media Content AnalysisPurpose Evaluate the quality and value of.docx
 
Mayan gods and goddesses are very much a part of this text.  Their i.docx
Mayan gods and goddesses are very much a part of this text.  Their i.docxMayan gods and goddesses are very much a part of this text.  Their i.docx
Mayan gods and goddesses are very much a part of this text.  Their i.docx
 
Media and SocietyIn 1,100 words, complete the followingAn.docx
Media and SocietyIn 1,100 words, complete the followingAn.docxMedia and SocietyIn 1,100 words, complete the followingAn.docx
Media and SocietyIn 1,100 words, complete the followingAn.docx
 
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docxMBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
MBA 5110 – Business Organization and ManagementMidterm ExamAns.docx
 

Recently uploaded

Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Recently uploaded (20)

Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Project 2Project 2.pdfIntroduction to Programming EECS 1.docx

  • 1. Project 2/Project 2.pdf Introduction to Programming EECS 1500 Project 2 Elementary Aspects of C++ 100 Points - Due Thursday February 11 in class The revision is for part a on Modulo division Note: These projects should be completed by February 4. They are all formally due in class, on Thursday February 11. This later date is only given to help students who enroll late for the class. a. Modulo Division Write a program to read in a 3-digit integer and print out the sum of the digits of the integer. Use the % operator to extrct the digits and use the / operator to extract the digit. Use the following format for input/output: Enter an integer: 744 The sum of the digits is: 15 b. Approximating Pi Pi can be computed using the formula 4 * (1.0 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - . . .) Write a program to display the result of 4 * (1.0 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13) Note: be sure to use 1.0 not 1 in your program. c. Wind Chill The National Weather Service has a relatively new formula to measure the wind chill temperature. The formula is
  • 2. Wind Chill = 35.74 + 0.6215T - 35.75V0.16 + 0.4275TV0.16 where T = outside temperature (°F) and V = wind velocity (mph). The formula cannot be used for wind speeds below 2 mph, temperatures below -58°F, or temperatures above 41°F. Write a program that prompts the user to enter a temperature and a wind speed, and then displays the wind chill temperature. You may assume the values entered are valid. Enter temperature(Fahrenheit): 5.3 Enter wind speed(mph): 6 The wind chill index is -5 d. Distance Given the two points (x1, y1) and (x2, y2), the distance between these points is given by the formula: Write a program that prompts the user to enter the two points, and then displays the distance between them. You may assume the values entered are valid. For example, Enter x1 and y1: 1.0 5 Enter x2 and y2: -2.0 1 The distance is 5.0 Project 2/quiz1.txt
  • 3. package splitter; import java.util.Scanner; public class Split { public static void main(String[] args) { int i = 234; sumDigits(i); } private static void sumDigits(int digits) { System.out.println("digits before calculation: " + digits); int sum = 0; while ( digits > 0 ) { sum += digits % 10; digits /= 10;
  • 4. System.out.println("sum: " + sum); System.out.println("digits after calculation: " + digits); } } } Project 2/quiz2.txt package pi; public class Pi { public static void main(String[] args) { double pi; pi=4*((1.0+1/5+1/9+1/13)-(1/3+1/11+1/7)); System.out.print("The Pi is :" +pi); }
  • 5. } Project 2/quiz3.txt package temperature; import java.util.Scanner; public class Temperature { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter temperature in Farehneit "); int t = scan.nextInt(); System.out.print("Enter wind Velocity (in MPH) "); int v = scan.nextInt(); if (v>2){ if (t>-58 && t<41){ double WindChill = 35.74+0.6215*t+ Math.pow(0.4275*v,0.16)-Math.pow(35.74*v, 0.16);
  • 6. System.out.print("The temperature is :"+WindChill); } else{ System.out.print("Check the extreme values of temperature"); } } else{ System.out.print("Wind speed cannot be less than 2 mph"); } } } Project 2/quiz4.txt package distance; import java.util.Scanner;
  • 7. public class Distance { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter x1 and y1"); double x1 = scan.nextInt(); double y1 = scan.nextInt(); System.out.print("Enter x2 and y2"); double x2 = scan.nextInt(); double y2 = scan.nextInt(); double d = Math.sqrt(Math.pow((x2-x1), 2)+Math.pow((y2- y1), 2)); System.out.print("The distance is "+d) ; } }