New Posts  All Forums:Forum Nav:

Java modifier help

post #1 of 5
Thread Starter 
import apcslib.*;
import chn.util.*;

public class Card {
//instance variables
private String mySuit;
private String myCardName;
private int myValue;

//Constructors
public Card()
{
mySuit = "";
myCardName = "";
myValue = setValue();
}

public Card(String suit, String cardName)
{
mySuit = suit;
myCardName = cardName;
myValue =setValue();
}

//Modifiers
private int setValue()
{
//your assignment tonight is to fill this in......
//What goes here??

return 0;
}

//Accessors
public String getSuit()
{
return mySuit;
}

public int getValue()
{
return myValue;
}
}
USS-Enterprise
(20 items)
 
USS-HTPC
(9 items)
 
 
CPUMotherboardGraphicsRAM
Intel E8400 P5W-DH-Deluxe HIS Radeon HD 6870 Crucial Ballistix Tracer 
Hard DriveHard DriveHard DriveOptical Drive
WD Caviar Maxtor Seagate Barracuda Sony DVD-ROM 
Optical DriveCoolingCoolingCooling
NEC DVD-RW Dtek Fuzion Swiftech Blackice 
CoolingOSMonitorKeyboard
Swiftech Pump Windows 7 Ultimate x64 Asus 23" Logitech G15 
PowerCaseMouseAudio
Enermax Liberty 500W Antec P180 Logitech G7 Razer AC-1 
CPUMotherboardRAMHard Drive
Intel i5 3570k AsRock Z77 Pro4-m Corsair XMS Crucial 64gb SSD 
Hard DriveOptical DriveOSPower
Western Digital Caviar 1TB Green LG Blu-Ray Drive Windows 7 Ultimate Antec EarthWatts 
Case
Silverstone GD04B 
  hide details  
Reply
USS-Enterprise
(20 items)
 
USS-HTPC
(9 items)
 
 
CPUMotherboardGraphicsRAM
Intel E8400 P5W-DH-Deluxe HIS Radeon HD 6870 Crucial Ballistix Tracer 
Hard DriveHard DriveHard DriveOptical Drive
WD Caviar Maxtor Seagate Barracuda Sony DVD-ROM 
Optical DriveCoolingCoolingCooling
NEC DVD-RW Dtek Fuzion Swiftech Blackice 
CoolingOSMonitorKeyboard
Swiftech Pump Windows 7 Ultimate x64 Asus 23" Logitech G15 
PowerCaseMouseAudio
Enermax Liberty 500W Antec P180 Logitech G7 Razer AC-1 
CPUMotherboardRAMHard Drive
Intel i5 3570k AsRock Z77 Pro4-m Corsair XMS Crucial 64gb SSD 
Hard DriveOptical DriveOSPower
Western Digital Caviar 1TB Green LG Blu-Ray Drive Windows 7 Ultimate Antec EarthWatts 
Case
Silverstone GD04B 
  hide details  
Reply
post #2 of 5
Well I don't want to just answer it for you. I think your making it to hard on yourself. How do you modify a variable, or in other terms change it? Got any ideas that come to mind?
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
Reply
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
Reply
post #3 of 5
Do you want it to be randomly assigned? How is the value determined

Also, why does setValue() return int? Just make it return void
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
post #4 of 5
Also Modifier/Setter shouldn't return anything, thats what the get methods are for. The setters are just assigning the variable the new data.
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
Reply
BlackMesa
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom II x6 Gigabyte XFX RF460 16gb G.Skill 
Hard DriveHard DriveOSMonitor
OCZ Vertex2 Sata II Coorsair Force GS Sata III Debian (testing) Shimian 27" 
KeyboardMouse
Filco w/ blue cherries Who needs a mouse? 
  hide details  
Reply
post #5 of 5
Thread Starter 
thx i got it =]
USS-Enterprise
(20 items)
 
USS-HTPC
(9 items)
 
 
CPUMotherboardGraphicsRAM
Intel E8400 P5W-DH-Deluxe HIS Radeon HD 6870 Crucial Ballistix Tracer 
Hard DriveHard DriveHard DriveOptical Drive
WD Caviar Maxtor Seagate Barracuda Sony DVD-ROM 
Optical DriveCoolingCoolingCooling
NEC DVD-RW Dtek Fuzion Swiftech Blackice 
CoolingOSMonitorKeyboard
Swiftech Pump Windows 7 Ultimate x64 Asus 23" Logitech G15 
PowerCaseMouseAudio
Enermax Liberty 500W Antec P180 Logitech G7 Razer AC-1 
CPUMotherboardRAMHard Drive
Intel i5 3570k AsRock Z77 Pro4-m Corsair XMS Crucial 64gb SSD 
Hard DriveOptical DriveOSPower
Western Digital Caviar 1TB Green LG Blu-Ray Drive Windows 7 Ultimate Antec EarthWatts 
Case
Silverstone GD04B 
  hide details  
Reply
USS-Enterprise
(20 items)
 
USS-HTPC
(9 items)
 
 
CPUMotherboardGraphicsRAM
Intel E8400 P5W-DH-Deluxe HIS Radeon HD 6870 Crucial Ballistix Tracer 
Hard DriveHard DriveHard DriveOptical Drive
WD Caviar Maxtor Seagate Barracuda Sony DVD-ROM 
Optical DriveCoolingCoolingCooling
NEC DVD-RW Dtek Fuzion Swiftech Blackice 
CoolingOSMonitorKeyboard
Swiftech Pump Windows 7 Ultimate x64 Asus 23" Logitech G15 
PowerCaseMouseAudio
Enermax Liberty 500W Antec P180 Logitech G7 Razer AC-1 
CPUMotherboardRAMHard Drive
Intel i5 3570k AsRock Z77 Pro4-m Corsair XMS Crucial 64gb SSD 
Hard DriveOptical DriveOSPower
Western Digital Caviar 1TB Green LG Blu-Ray Drive Windows 7 Ultimate Antec EarthWatts 
Case
Silverstone GD04B 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming