Help with standard deviation assignment
I am having trouble with the std deviation portion of one of my assignments. Plus, only 5 test scored will print, not all 6. Could you please take a look and see what I am doing wrong? Is there a way to add the find the std dev. and mean for each semester?
----------------------Start Code------------------------------
public class Main {
int grades[][]={{15,20,15,20,15,20},
{14,21,14,21,14,21},{13,22,13,22,13},
{14,21,14,21,14,21},{15,20,15,20,15}};
int students, tests;
String output;
/** Creates a new instance of Main */
public Main() {
* @param args the command line arguments
public static void main(String[] args) {
Main m = new Main();
m.students = m.grades.length;
m.tests = m.grades[0].length;
m.output = "The scores are:\n";
m.buildString();
m.output += "\nMean: " + m.mean();
// + "\nStd Dev: " + m.StdDev() + "\n";
System.out.print(m.output);
public String mean(){
double mean = 0;
String outputMean = "";
for (int column = 0; column < students; column++){
int sumOfGrades = 0;
for (int row = 0; row < students; row++){
sumOfGrades += grades[row][column];
mean = sumOfGrades/students;
outputMean += mean + " ";
return outputMean;
// public double StdDev(){
// Main m = new Main();
// int sumOfGrades = 0;
// double StdDev = 0;
// for (int column = 0; column < students; column++){
// for (int row = 0; row < students; row++){
// sumOfGrades += Math.pow((grades[row][column]-mean()), 2);
// StdDev = Math.sqrt(mean/students) + " ";
// return StdDev;
public void buildString(){
output += " | Fall | Spring |\n";
output += " ";
for (int counter = 0; counter < tests; counter++)
output += "Test " + (counter + 1) + " ";
for (int row = 0; row < students; row++){
output += "\nStudent(" + (row + 1) + ") ";
for (int column = 0; column < tests -1; column++)
output += grades[row][column] + " ";
----------------------end code-----------------------------
------------------ Displays----------------
The scores are:
| Fall | Spring |
Test 1 Test 2 Test 3 Test 4 Test 5 Test 6
Student(1) 15 20 15 20 15
Student(2) 14 21 14 21 14
Student(3) 13 22 13 22 13
Student(4) 14 21 14 21 14
Student(5) 15 20 15 20 15
Mean: 14.0 20.0 14.0 20.0 14.0
-----------------end displays----------------
What I was thinking was that mean() would be a lot more useful if
(1) you passed it an argument saying what test you were interested in. This would
take the place of "column" in your code.
(2) it returned a double value which was the mean of the given test. The snippet you
posted is OK, except that it should return a double not an int. Ie it should look like: /** Returns the mean for a given test. */
public double mean(int column) {
double mean = 0.0;
// do calculation
return mean;
}Of course if you do this you will have to change how mean() is used from within main().
Instead of a simple "m.output += "\nMean: " + m.mean();" you will need a loop: // start the string
m.output += "\nMean: ";
for(int ndx = 0; ndx < tests; ++ndx) {
// append each mean
m.output += " " + mean(ndx);
}The standard deviation method will be very similar to the mean() one, and
used in a similar way: /** Returns the sd for a given test. */
public double mean(int column) {
double sd = 0.0;
// do calculation based on what was posted,
// or what you have been told to do.
return sd;
}
Similar Messages
-
Help on standard deviation please
I am writing a program to find standard deviation. Below is what I have so far "not much I know" but I have tried so don't get flame happy. It errors out and I have tried to fix it. I know the formula for standard deviaition but I can't seem to program it right. I also need to program the code to have three methods the main, an Average method, and a standard deviation method. I know how to make a method but I am having trouble on how to call them. Any help would be appreciated. I am not asking anyone to do my work for me just give me some tips. I would rather take a 0 on the assignement and learn later than turn in someone else's work becaue I will never pass my final if I do that.
import java.text.*;
import javax.swing.*;
class StandardDeviation{
public static void main(String [] args){
DecimalFormat df = new DecimalFormat("0.00");
//Average Code Segment
double [] values = {10,20,30,4,2}; //Assigns numbers to values
double valueAverage,square, sum = 0;
for(int i = 0; i < values.length; i ++){
sum += values;
valueAverage = sum / 5; //Computes Average
System.out.println("Average is: " +valueAverage); //Displays average of values to test to see if it worked
//Deviation Code Segment
for (int i = 0; i < values.length; ++i)
double diff = values - valueAverage;
sum+= diff*diff;
System.out.println(+ Math.sqrt(sum/(values.length - 1))); // here I was trying to test to see if my formula worked
I get the following error
java:20: operator - cannot be applied to double[],double
double diff = values - valueAverage;Okay this code works. Duffymo can you give me some pointers of writing this code using multiple methods? I can write the methods. I just have a hard time grasping the concept of calling them. I have had a hard time learning this in java. I also looked at some of your past posts on Standard Deviation I see what you are saying about the multiple methods. I know that I need a main method that would probably include the values. Then I would have a average method which would call the values to compute the average. Then I would have the StdDev method to compute the Standard deviation method. Any tips on where to begin on this?
mport java.text.*;
import javax.swing.*;
class StandardDeviation{
public static void main(String [] args){
DecimalFormat df = new DecimalFormat("0.00");
//Average Code Segment
double [] values = {10,20,30,4,2}; //Assigns numbers to values
double valueAverage,square, sum = 0;
for(int i = 0; i < values.length; i ++){
sum += values;
valueAverage = sum / 5; //Computes Average
System.out.println("Average is: " +valueAverage); //Displays average of values
//return valueAverage;
//Deviation Code Segment
for (int i = 0; i < values.length; ++i)
double diff = values[i]- valueAverage;
sum+= diff*diff;
System.out.println("The Standard deviation is: "+ df.format(Math.sqrt(sum/(values.length - 1)))); -
Help with RMI university assignment
Hi everybody,
The assignment asks for the definition of three remote interfaces ICompany, IProject and IStaff, define one 1:M relationship (ICompany -> IProject) and print on the console the company together with the projects they have placed. There is no requirement for a DB therefore i've create a method on the server
populateDummyDB(ProjectImpl proj)that fills a Vector with projects with their coresponding company ID's.
I've also created a company instance on the server which i successfully print on the client by callingprintCompany(Object obj) but i need help with theprintProjects() so that as soon the company is printed it searches the Vector for projects that have the same companyID matches the PK with the FK and print those projects.
Any help will be more than welcome.
Regards,
Nick Paicopoulos
BSc Applied Computing.Thanks for the reply and sorry for the vagueness.
The company is created and bound to RMI on the Server
CompanyImpl myCom = new CompanyImpl("101234", "WH Smith",
"Nick Parks", null);
myCom.bindToRMI("com1"); also on the Server the Vector that is defined in the ProjectImpl.java is populated
public static void populateDummyDB(ProjectImpl proj)
throws RemoteException {
proj.addProject(new ProjectImpl("Project A", "10 Feb 2005", 11000,
"101234", null, null));
proj.addProject(new ProjectImpl("Project B", "16 Feb 2005", 8700,
"178745", null, null));
proj.addProject(new ProjectImpl("Project C", "19 Feb 2005", 17400,
"130928", null, null));
proj.addProject(new ProjectImpl("Project D", "27 Feb 2005", 12800,
"178745", null, null));
proj.addProject(new ProjectImpl("Project E", "04 Mar 2005", 9760,
"101234", null, null));
proj.addProject(new ProjectImpl("Project F", "09 Mar 2005", 5340,
"178745", null, null));
proj.addProject(new ProjectImpl("Project G", "13 Mar 2005", 15290,
"101234", null, null));
proj.addProject(new ProjectImpl("Project H", "17 Mar 2005", 5780,
"101234", null, null));
proj.addProject(new ProjectImpl("Project I", "23 Mar 2005", 20100,
"130928", null, null));
proj.addProject(new ProjectImpl("Project J", "30 Mar 2005", 6780,
"130928", null, null));
} The company is printed successfully on the Client
public class HKClientView{
public static void main(String[] args) {
HKClientView cmdUI = new HKClientView();
public static final String SERVER_NAME = "localhost";
public HKClientView() {
ICompany yourCom = getRemoteCompany();
try {
CompanyTO yourComData = yourCom.getCompanyData();
printCompany(yourComData);
// printProjects();
} catch (RemoteException re) {
System.out.println("Exception thrown while creating company "
+ "instance! " + re);
private ICompany getRemoteCompany() {
ICompany myCompany = null;
ProjectImpl myProject = null;
try {
myCompany = (ICompany) Naming.lookup("//" + SERVER_NAME + "/com1");
} catch (Exception e) {
System.out.println("Exception thrown while creating company "
+ "instance! " + e);
return myCompany;
private void printCompany(Object obj) {
System.out.println(obj.toString());
} If you look closely at my dummy DB table four out of the ten projects belong to the company that i've created since the have common companyID = "101234". How can i get those projects printed on the Client?
Regards,
Nick Paicopoulos. -
Help with JAVA StringObject - & assign user input; StringMethod
Hi Everyone! I need help with this Java Program, I need to write a program, single class, & file. That will prompt the user to enter a word. The output will be separted by hypens and do this until the user enters exit. I think this is done by using a string variable. Then use the length of the word to setup a loop to print each letter out with hypens. (example c-a-t)
1. I think I should store the word like this: Word.Method(). Not sure of this the API was confusing for me because I wasn't sure of what to do.
2. A string method to find out how many letters are in the user's word in order to setup a loop to print each letter out. I think I can use a While loop to accomplish this?
3. A string method to access each letter in a string object individually in order to print individual letters to the screen with those hypens. This is really confusing for me? Can this be accomplished in the While loop? or do I declare variables in the main method.
Any examples you can refer me to would be greatly appreciated. ThanksGetting user input:
This may look strange to a newbie but there's nothing much you can do since you wanted a single class file:import java.io.*
public class InputTest {
public static void main(String[] args) {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Hi! Please type a word and press enter.");
String lineReadFromUser = in.readLine();
System.out.println("You typed " + lineReadFromUser);
}You can get the lenght of a String using the length() method. Example: int len = "Foobar".length();
You can get the individual characters of a String with the charAt() method. Example: char firstCharOfString = string.charAt(0);
(remember that the argument must be from 0 to length-1)
You can access the documentation of all classes, including java.lang.String, at http://java.sun.com/j2se/1.3/docs/api/index.html You can also download the docs. -
I need help with a java assignment
I am being taught java but dont really understand what i have to do. If you send me an email to [email protected] ill send you a copy and so help me with the assignement.
I am currently working on free web page so you can download the assignment.
Thank You Allhey, there's something wrong with my internet, i clicked on your email adress and nothing happened :(
too bad. maybe i can't do your assignment.
go see somee tutorials, maybe these will help you, also try to understand how API will elp you (to both you may find links from left column of this page) and also, see if there area some samples of how to do what you need to be done.
http://www.javaalmanac.com -- my favorited place for code samples.
also whan you have some saaignment or other task, then see if google finds you apropriate solution. and there's a search function in these forums as well.
i hope you get your homework doen in time... -
1941w - Need help with IP address assigning, and relay wireless to a DHCP server.
Hope someone can point me in the right direction -
Basically have a Win08 R2 DHCP server, and a 1941w router.
I've got the internet, got the lan clients getting DHCP ok (with ip helper-address set on the 0/0 internal interface).
Also have the SSID, and wireless clients can connect - but no IPs are being handed out, also not sure if I understand or did the bridging correctly or assigned IPs to the vlan or bvi1 correctly.
for ex:
DHCP server IP:
10.10.2.4
Router Ethernet internal interface 0/0 IP:
10.10.2.1
with helper-address 10.10.2.4 (lan clients are resolving IPs correctly from the DHCP server)
Vlan1 IP address:
10.10.3.1
Does this interface need the helper-address as well? (10.10.2.4)?
wlan-ap 0 IP address:
unnumbered
interface BVI1 IP address (static):
10.10.2.2
am i totally off? not even sure if i have the vlan bridged to the 0/0 adapter or not correctly - but as I said, i can get a wireless client to connect with the SSID.
would appreciate any advice/pointers, thanksof course - here is the router config:
=======================================================
Using 5591 out of 262136 bytes
version 15.1
no service pad
service tcp-keepalives-in
service tcp-keepalives-out
service timestamps debug datetime msec localtime show-timezone
service timestamps log datetime msec localtime show-timezone
service password-encryption
service sequence-numbers
hostname router
boot-start-marker
boot-end-marker
security authentication failure rate 3 log
security passwords min-length 6
logging buffered 51200
logging console critical
enable secret 5 $1$JWwK$.04.NFg7tQ82UTy68/hyv.
no aaa new-model
service-module wlan-ap 0 bootimage autonomous
no ipv6 cef
no ip source-route
ip cef
no ip bootp server
ip name-server 10.10.2.4
multilink bundle-name authenticated
crypto pki token default removal timeout 0
crypto pki trustpoint TP-self-signed-975501586
enrollment selfsigned
subject-name cn=IOS-Self-Signed-Certificate-975501586
revocation-check none
rsakeypair TP-self-signed-975501586
crypto pki certificate chain TP-self-signed-975501586
certificate self-signed 01 nvram:IOS-Self-Sig#3.cer
license udi pid CISCO1941W-A/K9 sn FTX155085QG
hw-module ism 0
ip tcp synwait-time 10
ip ssh time-out 60
ip ssh authentication-retries 2
interface Embedded-Service-Engine0/0
no ip address
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
shutdown
interface GigabitEthernet0/0
description $ETH-LAN$$ETH-SW-LAUNCH$$INTF-INFO-GE 0/0$$ES_LAN$$FW_INSIDE$
ip address 10.10.2.1 255.255.255.0
ip helper-address 10.10.2.4
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
ip nat inside
ip virtual-reassembly in
duplex auto
speed auto
no mop enabled
interface wlan-ap0
description Service module interface to manage the embedded AP
ip unnumbered GigabitEthernet0/0
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
arp timeout 0
no mop enabled
no mop sysid
interface GigabitEthernet0/1
description $ES_WAN$$FW_OUTSIDE$
ip address dhcp client-id GigabitEthernet0/1
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
ip nat outside
ip virtual-reassembly in
duplex auto
speed auto
no mop enabled
interface Wlan-GigabitEthernet0/0
description Internal switch interface connecting to the embedded AP
no ip address
interface Vlan1
ip address 10.10.3.1 255.255.255.0
ip helper-address 10.10.2.4
no ip redirects
no ip unreachables
no ip proxy-arp
ip flow ingress
ip forward-protocol nd
ip http server
ip http authentication local
ip http secure-server
ip http timeout-policy idle 60 life 86400 requests 10000
ip nat inside source list 1 interface GigabitEthernet0/1 overload
logging trap debugging
access-list 1 remark INSIDE_IF=GigabitEthernet0/0
access-list 1 remark CCP_ACL Category=2
access-list 1 permit 10.10.2.0 0.0.0.255
no cdp run
control-plane
line con 0
login local
transport output telnet
line aux 0
login local
transport output telnet
line 2
no activation-character
no exec
transport preferred none
transport input all
transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
stopbits 1
line 67
no activation-character
no exec
transport preferred none
transport input all
transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
line vty 0 4
privilege level 15
login local
transport input telnet ssh
line vty 5 15
privilege level 15
login local
transport input telnet ssh
scheduler allocate 20000 1000
end
=======================================================
and the ap config:
=======================================================
Using 2067 out of 32768 bytes
version 12.4
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
hostname ap
enable secret 5 $1$xKDT$GdLGeA6h.H9LKL9l3dPmj.
no aaa new-model
dot11 syslog
dot11 ssid WIFI1
vlan 1
authentication open
authentication key-management wpa
mbssid guest-mode
wpa-psk ascii 7 044B1E030D2D43632A
bridge irb
interface Dot11Radio0
no ip address
no ip route-cache
encryption vlan 1 mode ciphers aes-ccm
broadcast-key vlan 1 change 30
ssid WIFI1
antenna gain 0
station-role root
interface Dot11Radio0.1
encapsulation dot1Q 1 native
no ip route-cache
bridge-group 2
bridge-group 2 subscriber-loop-control
bridge-group 2 block-unknown-source
no bridge-group 2 source-learning
no bridge-group 2 unicast-flooding
bridge-group 2 spanning-disabled
interface Dot11Radio1
no ip address
no ip route-cache
encryption vlan 1 mode ciphers aes-ccm
broadcast-key vlan 1 change 30
ssid WIFI1
antenna gain 0
dfs band 3 block
channel dfs
station-role root
interface Dot11Radio1.1
encapsulation dot1Q 1 native
no ip route-cache
bridge-group 2
bridge-group 2 subscriber-loop-control
bridge-group 2 block-unknown-source
no bridge-group 2 source-learning
no bridge-group 2 unicast-flooding
bridge-group 2 spanning-disabled
interface GigabitEthernet0
description the embedded AP GigabitEthernet 0 is an internal interface connecting AP with the host router
no ip address
no ip route-cache
interface GigabitEthernet0.1
encapsulation dot1Q 1 native
no ip route-cache
bridge-group 1
no bridge-group 1 source-learning
bridge-group 1 spanning-disabled
interface BVI1
ip address 10.10.2.2 255.255.255.0
no ip route-cache
ip http server
no ip http secure-server
ip http help-path http://www.cisco.com/warp/public/779/smbiz/prodconfig/help/eag
bridge 1 route ip
line con 0
no activation-character
line vty 0 4
login local
end
============================================ -
I am stuck on some things and I can't find them in my book so here goes. I need to determine if a string is even or odd and then return letters from that word based on which it is.
I think i need to use a boolean for the even or odd (not for sure) and an if / else statement for the letters, but i am lost on some of the details. I should have to do some math to choose which letters i return, but not for sure on how to setup the math to use on a string.
can anybody help point me in the right direction with this
if you need more info on this let me know and i will try to explain it better.
thanksi mean that I need to determine if the number of letters in a word is even or odd.
and here is the code the first one is my main class. I hope i did that right on the posting of the code
package wordstester;
import javax.swing.JOptionPane;
* @author christopher izatt
public class WordsTester {
* @param args the command line arguments
public static void main(String[] args) {
// prompt the user to enter a string of their choice
String wordChosen;
wordChosen = JOptionPane.showInputDialog
("Please enter a word of your choice here");
String middlePart;
middlePart = Words.getMiddle(wordChosen);
System.out.println("At the middle of " + wordChosen + " is: "
+ middlePart);
package wordstester;
* @author christopher izatt
public class Words {
Gets the middle character or character pair from this word
when possible.
@param word a word supplied by the method user
@return the middle character (if the word length is odd) or
middle two characters (if it is even), or the empty string if
the word is empty, or null if it is null.
public static String getMiddle(String word)
private boolean word;
} -
Abap-OOPS Help with standard class Cl_RSPLFC_COPY
Please help me out in expanding the functionality of an existing class cl_rsplfc_copy .As i want 2 copy some data from one cube 2 an another cube taking some characters common in both the cubes.
Is there any specific reason you want to use exit, when there is a standard copy planning function which does the copy without any customization? Why not use a multiplanning area and copy its simple to implement and maintain.
-
Need Help with my School Assignment - Error Message
Hey guys,
I'm doing a school assignment for my Object Oriented Java programing class. Here's the assignment requirements:
"There are five kinds of flowers, and their associated costs. Create an array of strings that holds the names of these flowers. Create another array that holds the cost of each corresponding flower. Your program should read the name of a flower and the quantity desired by a customer. Locate the flower in the name array and use that index to find the cost per stem in the cost array. Compute and print the total cost of the sale. Write your solution in one class: FlowerCounterArray.
The solution should implement the following two methods:
- addOrder(String flowerName, int quantity) to add to the order. This is in addition to reading from the terminal.
- printTotal() to print out the total cost to the terminal."
I wrote up some code so far and I want to test it, but I am getting this error: "']' expected" on the newFlower[0] = new FlowerCounterArrays("petunia", 0.50]; line near the end of the code.
Here's my code:
public class FlowerCounterArrays {
private String flowerName;
private double price;
public void addOrder(String flowerName, int quantity) {
for (FlowerCounterArrays flower : newFlower) {
if (flower.equals(flowerName)) {
total = price * quantity;
System.out.println("The price for " + quantity + " " + flower + "(s) is " + total);
else {
System.out.println("Unfortunately we do not carry that type of flower here.");
public void printTotal() {
System.out.println(total);
FlowerCounterArrays[] newFlower = new FlowerCounterArrays[5];
newFlower[0] = new FlowerCounterArrays("petunia", 0.50];
newFlower[1] = new FlowerCounterArrays("pansy", 0.75);
newFlower[2] = new FlowerCounterArrays("rose", 1.50);
newFlower[3] = new FlowerCounterArrays("violet", 0.50);
newFlower[4] = new FlowerCounterArrays("carnation", 0.80);
}Thanks for the help guys! Much appreciated!
Edited by: he4dhuntr on Oct 14, 2008 1:33 PMOk. I'm kind of new to all this, so some stuff I'm not 100% clear on.
I get what you're saying though. I put the array into the method.
Although now I get a new errod: "cannot find symbol - constructor FlowerCounterArrays(java.lang.String,double)"
I get this error on my newFlower[0] = new FlowerCounterArrays("petunia", 0.50); line
Here's my new code:
public class FlowerCounterArrays {
private String flowerName;
private double price;
public void addOrder(String flowerName, int quantity) {
FlowerCounterArrays[] newFlower = new FlowerCounterArrays[5];
newFlower[0] = new FlowerCounterArrays("petunia", 0.50);
newFlower[1] = new FlowerCounterArrays("pansy", 0.75);
newFlower[2] = new FlowerCounterArrays("rose", 1.50);
newFlower[3] = new FlowerCounterArrays("violet", 0.50);
newFlower[4] = new FlowerCounterArrays("carnation", 0.80);
for (FlowerCounterArrays flower : newFlower) {
if (flower.equals(flowerName)) {
total = price * quantity;
System.out.println("The price for " + quantity + " " + flower + "(s) is " + total);
else {
System.out.println("Unfortunately we do not carry that type of flower here.");
public void printTotal() {
System.out.println(total);
}Thanks for the help so far! -
Help with product category assignment please
Hi experts,
I need to do a modificacion in my R3 downloaded products to CRM. Because a
product catalog fulfitment, I need to modify the assigned product hierarchy
in CRM but I don't know where can I do it this mapping between an R3 product
hierarchy and CRM product hierarchy.
I explain, if product A belongs in R3 to product category A, I need to modify
this assignment in CRM, for exmaple, product A in CRM will belong to product category
B.
Modifications/creations on product master are only downloaded to CRM, never upload
from CRM to R3.
Any help in this issue please? Is possible to get a behaviour like this?
Thanks to all.
JavierHi Javier,
You can always do a RFC data upload of the changed product from CRM to R/3. I guess you do know how to trigger a OLTP data transfer in product master maintenance transaction COMMPR01.
Thanks,
Sudipta. -
Team - Is there such thing as a guidelines document for creating Help? I have a software vendor developing Help for me (with RoboHelp) for the IT system they are creating. My concern is they aren't using any sort of recommended format. It just feels wrong. Any suggestions??
It was Colum McAndrew who replied to you. I blame his father for causing the confusion.
It is common for OLH to be created in a way that also generates a manual. How useful that is depends on the volume of text and the audience. If it is a complex application that can be configured in a zillion ways, then it is likely an app for a large organisation and someone there will want the complex explanations to help them write internal procedures. After that then it depends on whether the OLH is required to be exhaustive or whether separate training is available and the help is really an aide memoire.
Sometime an old fashioned approach is still good, sometimes it isn't.
Your knowledge of the users and what is being described has to be how you assess whether the OLH is fit for purpose.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
Please help me with my University assignment !!!
Hi
I really need help with my java assignment for university. Please look at the details of the assignment in the link below. I have to get this done by the 27th of this month. Any help would be greatly appreciated.
http://mercury.tvu.ac.uk/sdv/sdv_ass2r.html
Any links to tutorials would be brilliant.That reaction is kind of understandable by the way, do you have any idea just how many students try to get their homework done here, especially this time of the year?
It would help us to help you if you told us what exactly is the problem you have. Asking for help in general is fruitless - no one has time to walk you through it.
From the page you posted a link to, this is what you need to do first: * build a hierarchy of classes to represent the different vehicle types:
o build a class Vehicle to hold details common to all vehicles
(see Week 5 Building a class)
o extend class Vehicle to give the two classes
Car holds details particular to a car
Van holds details particular to a van
(see Week 6 Extending a class)
* build the main application class RentalCentre which:
o has the method main so is the class which is to be run
(see Weeks 5 and 6 - the test classes)
o has refereneces to the vehicles held by the centre; this is an array of Vehicles
(see Week 7 Arrays)Do you know how to do all of that? You are also given some code for those classes so you don't need to start from ground zero, I see. What about the rest, adding the definitions for methods and fields (or "attributes" like the page calls them) to the classes and implementing the methods? -
Im DROWNING! need help with a simple java assignment! plz someone help me!
i need help with my java assignment, with validating a sin number. easy for must who know java. im drowning... please help!
You will need to store each digit of the social insurance number in a field of its own. To validate the entry you will:
1. Multiply the 2nd, 4th, 6th and 8th digit by 2.
2. If the product of any of the four multiplications result in a value greater than 9, add the two resulting digits together to yield a single-digit response. For example 6 * 2 = 12, so you would add the 1 and the 2 to get a result of 3.
3. Add these four calculated values together, along with the 1st, 3rd, 5th, and 7th digits of the original number.
4. Subtract this sum from the next highest multiple of 10.
5. The difference should be equal to the 9th digit, which is considered the check digit.
Example of validating S.I.N. 765932546
1st digit 7
2nd digit (6*2 =12 1+2=) 3
3rd digit 5
4th digit (9*2 = 18 1+8 =) 9
5th digit 3
6th digit (2*2 = 4) 4
7th digit 5
8th digit (4*2 = 8) 8
Total 44 next multiple of 10 is 50
50-44 = 6 which is the 9th digit
Therefore the S.I.N. 765932546 is Valid
********* SIN Validation *********
Welcome - Please enter the first number: 120406780
Second digit value multiplied by 2 4
Fourth digit value multiplied by 2 8
Sixth digit value multiplied by 2 12
Eighth digit value multiplied by 2 16
Value derived from 6th digit 3
Value derived from 8th digit 7
The total is 30
Calculated digit is 10
Check digit must be zero because calculated value is 10
The SIN 120406780 is Valid
this is my assignemtn this is what i have! i dont know where to start! please help me!
/* File: sinnumber.java
Author: Ashley
Date: October 2006
Purpose: Lab1
import java.util.Scanner;
public class Lab1
public static void main(String[] args)
Scanner input = new Scanner(System.in);
int sin = 0;
int number0, number1, number2, number3, number4, number5, number6, number7, number8;
int count = 0;
int second, fourth, sixth, eighth;
System.out.print("\t\n**********************************");
System.out.print("\t\n**********SIN Validation**********");
System.out.print("\t\n**********************************");
System.out.println("\t\nPlease enter the First sin number: ");
sin = input.nextInt();
count = int.length(sin);
if (count > 8 || count < 8)
System.out.print("Valid: ");
} -
Actionscript help with interactive poster
Hi All,
I need some desperate help with a university assignment. I can't find any really good tutorials out there, so I was wondering if there were any kind people out there that I could get some on-on one help from?If you need one on one guidance for every aspect of the assignment then you probably need to look to your classmates or your instructor.
If you can show what you have done so far and what specific aspect you are having a problem with then someone might offer some help. -
Hi,
I am having following scnario of limits for the MICs
Char Lower Limit Upper Limit s/d-0.02
C 0.08 0.12
in the result recording if the user enters more than the specification system should check with standard deviation and valuation should happen according to standard deviation.
which field i have to use in the quantitative tab,how to solve this.
this varies material to material.
Regards,
Selva.Hi Selva,
You can use following functionality, which may serve your purpose.
Variable Inspection
Use
In a variable inspection, you must specify at least one tolerance limit in the inspection plan for the quantitative characteristic in question. ISO 3951 serves as a standard for a variable inspection. The Quality Management application component has two valuation procedures for variable inspections:
S-method, single-sided tolerance range
S-method, double-sided tolerance range
When you perform a variable inspection according to the s-method for normally distributed characteristic values, the sample size, mean value (x-bar), and standard deviation (s) of the characteristic values are required as inspection results. Depending on the recording form used, you either enter the statistics, or the system calculates them from the single values.
Depending on whether there is an upper specification value (USL) or a lower specification value (LSL) for the characteristic values, the inspection characteristic is rejected if the following conditions are met:
Mean > USL - k * s
or
Mean < LSL + k * s
The value k is the acceptance factor defined in the sampling plan. The mean value and standard deviation must be known.
If the tolerance range is limited on both sides (double-sided), there are two variants for conducting the s-method valuation. You define which variant is used in the function module for the valuation rule. The variants differ in their acceptance range.
When the s-method uses the double-sided tolerance range, both limits of the tolerance range are treated together. The share above the tolerance range and the share below are estimated and compared with a critical value that is calculated from the sample size and acceptance factor. This form of variable inspection leads to the same decision as the graphical procedure described in the ISO 3951 standard (see the figure below). Given the same sampling plan, the acceptance range is smaller than for the variant of the s-method in which the two limit values are handled separately. In this case, the upper and lower specification values are checked separately. The characteristic is rejected when one of the two rejection conditions is met.
Regards
Suhas
Maybe you are looking for
-
875p, I CANT LOCK my PCI / AGP Frequency using FAST,TURBO, or ULTRA
i have an 875p neo. i am one setting away from loving this mainboard(finally). i have a 2.8ghz running at 3.0 (with a 1:1 FSB/RAM). i can run stable in TURBO MODE, with "timings by SPD". i am using 1.7 bios (1.8 gives me lower performance). i tried a
-
Blank page after posting a reply?
I'm getting a blank page after I post a reply. I have to go back to my bookmark for the whole forum manually. Is this a feature or a bug? (Im using Safari)
-
RFC call from portal gives dump call_function_open_error
Hi all , We have a RFC function module where standarad BAPI BAPI_ENTRY_SHEET_CREATE IS USED where a dump call_function_open_error occurs when the rfc is called from portal , while on r3 it works fine. I wanted to know if somebody has faced this kind
-
I am a fairly competent BB user and have just upgraded from a Pearl to the blessed 8900. I love it so far, but I'm having problems backing it up. I can start it ok and it gets about halfway done the backup and then when it gets to "Smart Card Options
-
Today I have signed up for BT Linesaver following the receipt of a letter from BT. I have paid the £113.88 upfront online today. Linesaver gives you a reduction in the line rental if you pay 12 months line rental up front. I addition to saving a coup