3 Pages

LAB4

Course: CS 180, Fall 2010
School: Purdue
Rating:
 
 
 
 
 

Word Count: 598

Document Preview

Lab CS180 4 Lab Goals For this lab you will learn how to use ratio's to change the result of print statements. Use parsing/casting to determine letter grade from number grade. Using Ratio's For this lab you will have to use an ascii table, found here http://www.asciitable.com/. if you recall an int truncates all numbers, so 3.24 becomes just 3. This can be very valuable since it becomes very easy to round off...

Register Now

Unformatted Document Excerpt

Coursehero >> Indiana >> Purdue >> CS 180

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Lab CS180 4 Lab Goals For this lab you will learn how to use ratio's to change the result of print statements. Use parsing/casting to determine letter grade from number grade. Using Ratio's For this lab you will have to use an ascii table, found here http://www.asciitable.com/. if you recall an int truncates all numbers, so 3.24 becomes just 3. This can be very valuable since it becomes very easy to round off numbers and determine if they are within a set range. Say you are filling a cylinder with water and you want to know if the water is in the top half or bottom, by dividing the current level of the water by the half way marker and type casting it as an int you are able to get a 0 if it is in the lower half and a 1 if it is in the lower half. This is also very valuable for something such as a well which has a cylinder with spherical ends, each of which needs a different calculation for area, you can determine which calculation of area to use by using ratios. To print out a number as a char you simply type cast it with System.out.println((char) 70), which will print out A; Setup Before you begin, you need to create a folder called "lab04" in the CS180 folder to hold your .java file for this lab. Use the terminal to create this folder. % pwd /home/yourlogin/CS180 % mkdir lab04 % cd lab04 Formatter There are ways in java to format text so that it follows certain standards. In this lab your text must be formatted correctly. Instead of using System.out.println(); you will use System.out.format();. It is used slightly different then println, for example System.out.prinln("Name: " + yourName + "\nScore: " + yourScore); and System.out.format("Name: %d", %s%nScore: yourName, yourScore); are the same for more information follow this link http://download-llnw.oracle.com/javase/tutorial/java/data/numberformat.html The Lab YOU MUST USE FLOATS FOR ALL SCORES!!! For this lab you will need to take in scores for projects, lab, midterm 1, midterm 2, and final. Sample input. Enter Projects total: 50.4 Enter lab total: 65.7 Enter midterm #1 score: 83.5 Enter midterm #2 score: 87.2 Enter final exam score: 76.8 After obtaining the input. you will print out each score, the course total, and your letter grade. When determining the letter grade, you are not allowed to use If statements, switches, or any other conditionals. You should be able to obtain print out the letter grade using math and type casting. For the purpose of this Lab, exams are 15% of your grade, projects 25%, labs 15%, final 30% and that you have 5 projects and 13 labs. When determining the letter grade, use the following grading scale. A: 100-90 B: 89-80 C: 79-70 D: 69-60 F: 59 or below sample output. -=-=-=-=-=-=-=-=-=-= Projects: 50.4 Lab: 65.7 Midterm #1: 83.5 Midterm #2: 87.2 Final: 76.8 -=-=-=-=-=-=-=-=-=-= Course total: 476.2 -=-=-=-=-=-=-=-=-=-= Letter Grade: B All outputs must have 1 decimal place and be left justified like above. Turn In ***If you are working from home, remember after you think your code is right, compile and then run on lore*** To turn in first remove all the .class files from your Lab04 folder. % pwd /u/u91/yourlogin/CS180/lab04 % rm *.class Next change your current folder to your CS180 folder and run the turnin command. % cd ../ % turnin -v -c cs180=XXX -p lab4 lab04 *Where XXX is your section number (ask your lab TA).*
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Purdue - CS - 180
CS 180 Problem Solving and Object Oriented Programming Fall 2010 hMp:/www.cs.purdue.edu/homes/apm/courses/CS180Fall2010/ This Week: Notes for Week 7: Oct 48, 2010 2. 3. 4. 5. Aditya Mathur 10/6 6. Department of Computer Science 7. Purdue University 8.
Purdue - CS - 180
Purdue - CS - 180
Purdue - CS - 180
Purdue - CS - 180
Purdue - ECE 301 - 301
ECE 301, Homework #1, due date: 8/31/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlReview of calculus and arithmetics: Question 1: Compute the values of the following integrals. You can leave your answers in the form of trigonometric fun
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #2, due date: 9/07/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] Consider two functions f (t) and g(t) described as follows. 2 if -2 t < 0 f (t) = 1 if 0 t < 4 0 otherwise 3 + t if -3 t < 0 g(t) = 3
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #3, due date: 9/14/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Advanced] Consider two functions f (t) and g(t) described as follows. 1 if -2 t < 0 0 otherwise et 0 if t < 3 . otherwisef (t) = g(t) = Defi
Purdue - ECE 301 - 301
ECE 301, Homework #4, due date: 9/21/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.html Question 1: [Basic] Sketch the following discrete-time signals from n = -3 to n = 4. x[n] = 2U[n - 2] - 2U[n - 1] + U[n] x[n] = (n + 2)U[n - 1] - 3U[n] -
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #5, due date: 9/28/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.html Question 1: [Basic] p. 141, Problem 2.21 (b,d).Question 2: [Basic] p. 141, Problem 2.22 (a,e).Question 3: [Basic] This question is to verify the followi
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #6, due date: 10/05/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] Review of linear algebra: Consider row vectors dimension 3. Let of x1 = ( 2/2, - 2/2, 0), x2 = ( 3/3, 3/3, 3/3), and x3 = ( 6/6, 6/6,
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #7, due date: 10/12/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] p. 256, Problem 3.23(a,b). Hint: You need to use the solution of Textbook Problem 3.5 and the time-shift property of Fourier series r
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #8, due date: 10/26/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] p. 260, Problem 3.37.Question 2: [Basic] p. 261, Problem 3.38.Question 3: [Advanced] p. 261, Problem 3.39. Question 4: [Basic] For
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #9, due date: 11/02/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] p. 334, Problem 4.3.Question 2: [Basic] p. 334, Problem 4.4.Question 3: [Basic] p. 336, Problem 4.10.Question 4: [Basic] p. 336, P
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #10, due date: 11/09/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] Write down the synthesis and analysis formulae of DT FT. Question 2: [Basic] y[n] = cos( 3 n). Plot the DT FT Y (ej ). 2 Question 3:
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #11, due date: 11/16/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] Consider an AM-DSB signal y(t) = (x(t) + 0.5) cos(3t) is sent by a transmitter. 1. In what condition can we use asynchronous demodul
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #12, due date: 11/30/2011 http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Advanced] We use the basic setting as stated in p. 632, Problem 8.24(a). But we only need to answer the following questions instead: 1. Fin
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #13, due date: 12/7/2011http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] p. 801, Problem 10.21(ad).Question 2: [Basic] p. 801, Problem 10.21(eh).Question 3: [Basic] p. 801, Problem 10.22(a,b).Question 4:
Purdue - ECE 301 - 301
Purdue - ECE 301 - 301
ECE 301, Homework #14, No need to turn in this homework. The solution will be posted on Friday 12/9.http:/cobweb.ecn.purdue.edu/chihw/11ECE301F/11ECE301F.htmlQuestion 1: [Basic] p. 804, Problem 10.30.Question 2: [Basic] p. 802, Problem 10.24. Change th
Purdue - ECE 301 - 301
Purdue - ECE 382 - 382
School of Electrical and Computer EngineeringSchool of Electrical and Computer EngineeringCompensatorsR(s) + C(s) G(s)T (s) =R(s) + G (s) 1 + G (s)C(s) G(s) Uncompensated systemIf T(s) does not perform as desired, then we need to add an additional
Purdue - ECE 382 - 382
ECE 382Lead Compensator Design (Root-Locus)G(s) = 4 s(s + 2)Design Objective: = 0.5 and n = 4 rad/sec. (Interpret the design objective in terms of performance specification.) Procedure: 1) General form of a lead compensator Gc (s) = Kc (s + 1 ) 1 (s +
Purdue - ECE 382 - 382
ECE 382Review of Solutions of Linear Ordinary Differential Equations with Constant CoefficientsWe shall consider an nth -order, linear, ordinary differential equation with constant coefficients, and discuss some physical problems giving rise to such equ
Purdue - ECE 382 - 382
ECE 382 Laplace Transform L d f (t) = sF (s) - f (0); dt 1 ; (s + a) ; s2 + 2Some Useful FormulaeLd2 f (t) = s2 F (s) - sf (0) - f(0) 2 dtL e-at =L tn e-at = L [cos t] =n! (s + a)n+1 s s2 + 2L [sin t] = Second-order Systems2 n C(s) = T (s) = 2 ;
Purdue - ECE 382 - 382
Transfer FunctionsTransfer function is defined as: L cfw_output variable Transfer function = L cfw_input variable initial conditions are zero For example, find the transfer function Eo (s) of an RC circuit Ei (s)Block DiagramsA block diagram of a syste
Purdue - ECE 382 - 382
Feedback Control System CharacteristicsWhy study feedback control systems?R(s) R(s) G(s) C(s) vs. + E(s) _ G(s) C(s)Sensitivity AnalysisFor a system to perform well, it must be less sensitive to parameter variation. We would like to analyze how the va
Purdue - ECE 453 - 453
Lessons from Nanoscience: A Lecture Note SeriesVolume 1: Lessons from Nanoelectronics: A New Perspective on Transport Lectures 1-9 Supriyo Datta Purdue University datta@purdue.eduAugust 22, 2011For more information about the lecture note series, see ht
Purdue - ECE 453 - 453
Lessons from Nanoscience: A Lecture Note SeriesVolume 1: Lessons from Nanoelectronics: A New Perspective on Transport Lectures 10-17 Supriyo Datta Purdue University datta@purdue.eduSeptember 29, 2011For more information about the lecture note series, s
Purdue - ECE 453 - 453
10/05/07ECE 495N, Fall'07MSEE B010, MWF 330P 420PFundamentals of Nanoelectronics HW#4: Due Friday Oct.12 in class.Problem 1: Consider a (2x2) matrix of the formcos sin e- i A= sin e+ i - cos What are its eigenvalues? What are the corresponding eigen
Purdue - ECE 453 - 453
Purdue - ECE 453 - 453
10/12/07ECE 495N, Fall'07MSEE B010, MWF 330P 420PFundamentals of Nanoelectronics HW#5: Due Friday Oct.19 in class.All exercises, page numbers refer to S.Datta, Quantum Transport: Atom to Transistor, Cambridge (2005) HW#5: Due Friday Oct.19 in class. N
Purdue - ECE 453 - 453
10/19/06ECE 495N, Fall'07MSEE B010, MWF 330P 420PFundamentals of NanoelectronicsNote: Exam II on Monday Nov.5 in class.All exercises, page numbers refer to S.Datta, Quantum Transport: Atom to Transistor, Cambridge (2005)HW#6: Due Monday Oct.30 in cl
Purdue - ECE 453 - 453
Purdue - ECE 453 - 453
Purdue - ECE 453 - 453
Lessons from Nanoscience: A Lecture Note SeriesVolume 1: Lessons from Nanoelectronics: A New Perspective on Transport References/Appendices Supriyo Datta Purdue University datta@purdue.eduAugust 22, 2011For more information about the lecture note serie
Purdue - ECE - 311
Purdue - ECE - 311
Purdue - ECE - 311
Purdue - ECE - 311
Purdue - ECE - 311
Purdue - ECE - 311
Purdue - ECE - 311
Purdue - ECE - 311
Purdue - ECE - 311
ECE 311 Homework #9 Not to be turned inProblem 1: The following is the equation of the electric field intensity of an EM wave in free space. V E= - 35 cos(9.42x10 6 t + 3.14x10 -2 y)a z mA) What is the wavelength of the wave? B) What is the frequency o
Purdue - ECE - 311
Purdue - ECE - 311
Purdue - ECE - 305
NCNwww.nanohub.orgEE-305: Solid State Devices Solution Homework # 1Muhammad Ashraful Alam alam@purdue.eduAlam ECE-30511.1a)(i) Silicon (ii) GaAsb) crystalline material is uniform throughout while polycrystalline is uniform/crystalline in small sec
Purdue - ECE - 305
NCNwww.nanohub.orgEE-305: Solid State Devices Solution Homework #2Muhammad Ashraful Alam alam@purdue.eduAlam ECE-3051Q1Ego=1.170; a=4.730e-4; b=636; T=[0:1:600]; Eg=Ego-a.*(T.^2)./(T+b); Plot(T, Eg); hold on; Ego=1.205; a=2.8e-4; Eg=Ego-a.*T; Plot