Need help getting an area code out of my program.
I wrote a program that displays a phone number with a bunch of things, like mutators, constructors and what not. Then I created a test class to test the methods. It prints the phone number, but it won't extract the area code from the number. Any advice on what I'm doing wrong?
Here's my test class
public class PhoneNumberTest {
public static void main(String[] args)
PhoneNumber number=new PhoneNumber();
PhoneNumber code=new PhoneNumber();
number.setNum("612-219-9042");
System.out.println("Phone Number: "+ number);
System.out.println("Area Code: "+ code);
}Here's my class i'm testing
public class PhoneNumber {
private String wholeNum;
private String areaCode;
public PhoneNumber(){
wholeNum="";
areaCode="";
public PhoneNumber(String num, String code){
setPhone(code, num);
public String toString(){
return(areaCode+" "+wholeNum);
public String equals(){
return(areaCode);
public void setPhone(String num, String code){
wholeNum=num;
areaCode=code;
public PhoneNumber setAreaCode(String code){
areaCode=code;
return this;
public void setNum(String num){
wholeNum=num;
public void setCode(String code){
areaCode=code;
code=wholeNum.substring(0, 2);
public String getWholeNum(){
return wholeNum;
public String getAreaCode(){
return areaCode;
}
mk9000 wrote:
Okay. Well sorry about the post. I'll try to fix it all then.For starters, look at this "test" code:
PhoneNumber number=new PhoneNumber();
PhoneNumber code=new PhoneNumber();Do you really need two PhoneNumber objects to hold one phone number?
Similar Messages
-
I need help getting new authorization codes for digital copies
I need help getting new authorization codes for digital copies of movies. Can someone help me out?
There's a lot of results in Google when you search for this but unfortunately refreshing the page doesn't seem to generate a different code anymore. Mine also says already redeemed
-
I need help getting a new code for the yosemite beta because mine says it's already been used
I signed up for the yosemite beta and when I clicked the code to download the beta, nothing happened. I backed out and did it again and then it said the code was already in use. I have tried refreshing the page with the code in safari but the same one keeps coming back. I also signed out of the app store and logged back in to see if it was in my purchases and it doesn't show up. I need a little help here getting the beta.
There's a lot of results in Google when you search for this but unfortunately refreshing the page doesn't seem to generate a different code anymore. Mine also says already redeemed
-
I need help getting sound to come out of my TV when using HDMI. Any solutions?
I'm able to pull up my picture when connecting my HDMI cable to my Macbook pro...however I can't get the sound to come out of my Toshiba TV. When I go under system preferences, then sound and select my Toshiba TV as an option. It says it has no output controls. I fiddled with my sound setting in my TV and stil no luck. Does anyone know any solutions for this problem. Help is greatly appreciated.
Hey jbarwins
Check to make sure that you are up to date on your computer. Another recommendation would be to try a different cable and also reset the NVRAM on your computer.
About NVRAM and PRAM
http://support.apple.com/kb/HT1379
OS X Mountain Lion: Use a television as a display
http://support.apple.com/kb/HT1339
Thanks for using Apple Support Communities.
Regards,
-Norm G. -
I haven't used an Apple computer for years. I need help getting started
I just bought a mac mini after 20 years using a PC. I need help getting started. Any beginning manuals out there? Thanks.
New User of Apple wrote:
I just bought a mac mini after 20 years using a PC. I need help getting started. Any beginning manuals out there? Thanks.
Welcome back. Do not overlook the Finder and individual application Help menu support. The links provided above are great starter references. With tongue in cheek, they also may not be as current as the OS X release on your mini, so expect some differences.
Here are a litany of keyboard short-cuts, last updated in June 2012, that may prove selectively beneficial.
For actions like copy(c), paste(v), cut(x), print(p), and select-all(a), substitute the command key instead of control key.
If you right click on a file, this menu will seem familiar. Press the option key and notice the menu changes. If you copy a file(s) from this menu, change to the destination and then press option with the right button menu to see copy file(s) changed to move file(s).
To quickly view a file's contents, left click on the file icon, then press the space bar.
The native file format for OS X is PDF. Thus, when you choose to print, you also have the option to save as PDF with web links preserved.
Enjoy your mini. -
I've got a period to date report with following columns:
week1 tots, week2 tots, week3 tots, week4 tots, week5 tot, period-to-date tots, year-to-date tots
I have a SELECT statement which totals data for the entire year and separates current period totals
by grouping on the week_nbr . Any date between beginning of year and the end of the previous period will be week 0
The Select statement retursn 6 rows: 1 for each week in period and one with week_nbr = 0 which represents the totals from the beginning of year
to the end of the previous period.
the select statement returns the data correctly . I need help getting the YTD total for (weeks 1 - 5) + (totals for week 0) for each column.
This means that I will have a 7th record containing the YTD totals. ( I am not concerned with the PTD totals)
I tried sum by partition but complex decode statement gave me problems.
CREATE TABLE PERIOD_DATA
( "HOT_DOG_STAND_ID" NUMBER NOT NULL ENABLE,
"WEEK_DATE" DATE,
"NET_SALES2" NUMBER,
"BUNS24434" NUMBER,
"PICKELS_AW38" NUMBER,
"MUSTARD_TB56" NUMBER,
"CHICKENHEADS33" NUMBER,
"PIECES_SOLD34" NUMBER,
"SCRAPS35" NUMBER,
"PIECES_UNACCOUNTED" NUMBER
REM INSERTING into PERIOD_DATA
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('29-DEC-08','DD-MON-RR HH.MI.SSXFF AM'),14301.39,13951.26,3431.13,0,3680,2484,378,818);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('05-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),14651.37,14651.37,3249.55,0,3200,2419,505,276);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('12-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),14169.89,14169.89,2463.53,0,3136,2080,474,582);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('19-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),15864.46,15864.46,3245.49,0,3472,2764,475,233);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('26-JAN-09','DD-MON-RR HH.MI.SSXFF AM'),15961.2,15916.23,3395.51,0,3648,2838,392,418);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('02-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),19066.4,19066.4,4165.07,0,4336,3682,333,321);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('09-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),18415.74,18415.74,4024.74,0,4032,3365,482,185);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('16-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),18014,17849,3486.33,0,3840,3238,374,228);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('23-FEB-09','DD-MON-RR HH.MI.SSXFF AM'),18671.09,18626.12,3729.42,0,3888,2970,353,565);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('02-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),17636,17636,3815,0,3424,2840,490,94);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('09-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),17235.52,17145.58,3897.42,0,3504,2928,421,155);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('16-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),15989.27,15989.27,3372.95,0,3728,3051,369,308);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('23-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),19067.69,18960.41,4152.6,0,4048,3293,442,313);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('30-MAR-09','DD-MON-RR HH.MI.SSXFF AM'),18717.99,18717.99,3923.69,0,4408,3219,593,596);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('06-APR-09','DD-MON-RR HH.MI.SSXFF AM'),17335.16,17335.16,3769.08,0,3928,2997,514,417);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('13-APR-09','DD-MON-RR HH.MI.SSXFF AM'),18967.39,18967.39,4157.76,0,4144,2991,527,626);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('20-APR-09','DD-MON-RR HH.MI.SSXFF AM'),23090.88,23090.88,4427.96,0,5544,4493,560,491);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('27-APR-09','DD-MON-RR HH.MI.SSXFF AM'),24197.98,24132.99,4248.66,0,6680,5190,606,884);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('04-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),20202.21,20137.22,3714.68,0,7052,6170,422,460);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('11-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),18514.48,18514.48,3266.06,0,5508,4178,571,759);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('18-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),18678.68,18678.68,3814.07,0,5824,4345,633,846);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('25-MAY-09','DD-MON-RR HH.MI.SSXFF AM'),17937.18,17937.18,3051.52,0,4844,4986,529,-671);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('01-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),17445.75,17445.75,3079.91,0,5028,4810,656,-438);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('08-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),17327.88,17327.88,3263.29,0,6112,4674,672,766);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('15-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),17241.72,16937.33,3328.27,0,5792,4490,567,735);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('22-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),16625.83,16625.83,3485.18,0,5408,4319,761,328);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('29-JUN-09','DD-MON-RR HH.MI.SSXFF AM'),17002.84,17002.84,3091.09,0,5664,4369,544,751);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('06-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),16339.19,16274.2,3075.3,0,4784,3440,697,647);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('13-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),17165.12,16885.14,3458.03,0,4320,3296,640,384);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('20-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),17029.77,16899.79,3198.91,0,4448,3449,645,354);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('27-JUL-09','DD-MON-RR HH.MI.SSXFF AM'),16596.89,16596.89,3015.54,0,4624,3288,665,671);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('03-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),16468.58,16468.58,2981.35,0,2224,3495,564,-1835);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('10-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),18625.48,18550.5,3524.44,0,4856,3482,578,796);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('17-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),24538.54,24323.55,5580.71,0,5260,3771,608,881);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('24-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),18081.37,18081.37,3533.45,0,5980,3080,553,2347);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('31-AUG-09','DD-MON-RR HH.MI.SSXFF AM'),17183.25,17183.25,3487.12,0,2544,3262,615,-1333);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('07-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),17688.41,17575.29,3424.17,0,4800,3480,591,729);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('14-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),18211.29,18211.29,3806.32,0,3968,3104,527,337);
Insert into PERIOD_DATA (HOT_DOG_STAND_ID,WEEK_DATE,NET_SALES2,BUNS24434,PICKELS_AW38,MUSTARD_TB56,CHICKENHEADS33,PIECES_SOLD34,SCRAPS35,PIECES_UNACCOUNTED) values (141,to_timestamp('21-SEP-09','DD-MON-RR HH.MI.SSXFF AM'),16809.21,16744.22,3014.61,0,4128,3124,710,294);
SELECT HOT_DOG_STAND_ID
, DECODE(TRUNC(week_date , 'iw') ,
to_date('24-AUG-09' , 'dd-mon-rr') , 1 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 7 , 2 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 14 , 3 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 21 , 4 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 28 , 5 , 0) AS week_nbr
, SUM(NET_SALES2) AS net_sales2
, SUM(BUNS24434 ) BUNS24434
, SUM(PICKELS_AW38) PICKELS_AW38
, SUM(MUSTARD_TB56) MUSTARD_TB56
, SUM(CHICKENHEADS33) CHICKENHEADS33
, SUM(PIECES_SOLD34) PIECES_SOLD34
, SUM(SCRAPS35) SCRAPS35
, SUM(PIECES_UNACCOUNTED) * - 1 PIECES_UNACCOUNTED
/*--== Head average net_sales / chickenusage*/
, CASE
WHEN NVL( SUM(ChickenHeads33) / 8 , 0) = 0 THEN 0
ELSE ROUND(SUM(net_sales2) / ( SUM(ChickenHeads33) / 8 ) , 2)
END AS Head_average
/*--=== Efficiency = (ChickenUsage - scrappedDiv8 - unaccountedDiv8) / ChickenUsage) * 100*/
, CASE
WHEN NVL(SUM(ChickenHeads33) / 8 , 0) = 0 THEN 0
ELSE ROUND((((SUM(ChickenHeads33) / 8 ) - ( SUM(scraps35) / 8 ) - (SUM(pieces_unaccounted) / 8 )) / (SUM(ChickenHeads33) / 8 )) * 100 , 2)
END AS efficiency
FROM period_data per
WHERE week_DATE BETWEEN TRUNC(TO_DATE( '24-AUG-09' , 'DD-MON-YY') , 'IY') AND TRUNC(TO_DATE( '24-AUG-09' , 'DD-MON-YY') , 'IW') + 6 + 7 * 4
GROUP BY hot_dog_stand_id
, DECODE(TRUNC(week_date , 'iw') ,
to_date('24-AUG-09' , 'dd-mon-rr') , 1 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 7 , 2 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 14 , 3 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 21 , 4 ,
to_date('24-AUG-09' , 'dd-mon-rr') + 28 , 5 ,
0)
ORDER BY DECODE(TRUNC(week_date , 'iw') , to_date('24-AUG-09' , 'dd-mon-rr') , 1 , to_date('24-AUG-09' , 'dd-mon-rr') + 7 , 2 , to_date('24-AUG-09' , 'dd-mon-rr') + 14 , 3 , to_date('24-AUG-09' , 'dd-mon-rr') + 21 , 4 , to_date('24-AUG-09' , 'dd-mon-rr') + 28 , 5 , 0);The expected results will be:
HOT_DOG_STAND_ID WEEK_NBR NET_SALES2 BUNS24434 PICKELS_AW38 MUSTARD_TB56 CHICKENHEADS33 PIECES_SOLD34 SCRAPS35 PIECES_UNACCOUNTED HEAD_AVERAGE EFFICIENCY
141 7 697067.09 694887.4 139149.91 0 175808 139454 21036 15318 31.72 79.32 You can get these dame results by running endpot-to-endpoint query:
SELECT HOT_DOG_STAND_ID
, max(7) as week_nbr
,sum(NET_SALES2) net_sales2
,sum(BUNS24434 ) BUNS24434
,sum(PICKELS_AW38) PICKELS_AW38
,sum(MUSTARD_TB56) MUSTARD_TB56
,sum(CHICKENHEADS33) CHICKENHEADS33
,sum(PIECES_SOLD34) PIECES_SOLD34
,sum(SCRAPS35) SCRAPS35
,sum(PIECES_UNACCOUNTED) PIECES_UNACCOUNTED
---===== Copied code from outer query
--== net_sales / chickenusage
, CASE
WHEN NVL( sum(ChickenHeads33) / 8 ,0) = 0 then 0
ELSE ROUND(sum(net_sales2)/ ( sum(ChickenHeads33) / 8 ) , 2)
END as Head_average
--=== Efficiency = (ChickenUsage - scrappedDiv8 - unaccountedDiv8) / ChickenUsage) * 100
, CASE
WHEN NVL(sum(ChickenHeads33) / 8 ,0) = 0 then 0
ELSE ROUND((((sum(ChickenHeads33) / 8 ) - ( sum(scraps35) / 8 ) - (sum(pieces_unaccounted) / 8 )) / (sum(ChickenHeads33) / 8 )) * 100, 2)
END as efficiency
from period_data
WHERE week_DATE BETWEEN TRUNC(TO_DATE( '24-AUG-09' ,'DD-MON-YY'), 'IY') AND TO_DATE( '27-sep-09' ,'DD-MON-YY')
group by hot_dog_stand_id;Thanks In AdvanceHi,
Welcome to the forum!
Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful. You could teach something to some people who have been using this forum for years (except that nobody can teach them).
user12335325 wrote:
The expected results will be:
HOT_DOG_STAND_ID WEEK_NBR NET_SALES2 BUNS24434 PICKELS_AW38 MUSTARD_TB56 CHICKENHEADS33 PIECES_SOLD34 SCRAPS35 PIECES_UNACCOUNTED HEAD_AVERAGE EFFICIENCY
141 7 697067.09 694887.4 139149.91 0 175808 139454 21036 15318 31.72 79.32
Do you mean the expected results will include the row above, and that the results will be this row along with the 6 rows you're already getting? (If you wanted just that one row, I suppose you would just run your second query.)
That sound like a job for ROLLUP.
VARIABLE start_date VARCHAR2 (11);
EXEC :start_date := '24-AUG-2009';
SELECT HOT_DOG_STAND_ID
, NVL (CASE
WHEN week_date >= TO_DATE( :start_date, 'DD-MON-YYYY')
AND week_date < TO_DATE( :start_date, 'DD-MON-YYYY') + 35
THEN 1 + FLOOR ( (week_date - TO_DATE( :start_date, 'DD-MON-YYYY'))
/ 7
ELSE 0
END
, 7
) AS week_nbr
, SUM(NET_SALES2) AS net_sales2
, SUM(BUNS24434 ) BUNS24434
, SUM(PICKELS_AW38) PICKELS_AW38
, SUM(MUSTARD_TB56) MUSTARD_TB56
, SUM(CHICKENHEADS33) CHICKENHEADS33
, SUM(PIECES_SOLD34) PIECES_SOLD34
, SUM(SCRAPS35) SCRAPS35
, SUM(PIECES_UNACCOUNTED) * - 1 PIECES_UNACCOUNTED
/*--== Head average net_sales / chickenusage*/
, CASE
WHEN NVL( SUM(ChickenHeads33) / 8 , 0) = 0 THEN 0
ELSE ROUND(SUM(net_sales2) / ( SUM(ChickenHeads33) / 8 ) , 2)
END AS Head_average
/*--=== Efficiency = (ChickenUsage - scrappedDiv8 - unaccountedDiv8) / ChickenUsage) * 100*/
, CASE
WHEN NVL(SUM(ChickenHeads33) / 8 , 0) = 0 THEN 0
ELSE ROUND((((SUM(ChickenHeads33) / 8 ) - ( SUM(scraps35) / 8 ) - (SUM(pieces_unaccounted) / 8 )) / (SUM(ChickenHeads33) / 8 )) * 100 , 2)
END AS efficiency
FROM period_data per
WHERE week_DATE BETWEEN TRUNC(TO_DATE( '24-AUG-09' , 'DD-MON-YY') , 'IY') AND TRUNC(TO_DATE( '24-AUG-09' , 'DD-MON-YY') , 'IW') + 6 + 7 * 4
GROUP BY hot_dog_stand_id
, ROLLUP (
CASE
WHEN week_date >= TO_DATE( :start_date, 'DD-MON-YYYY')
AND week_date < TO_DATE( :start_date, 'DD-MON-YYYY') + 35
THEN 1 + FLOOR ( (week_date - TO_DATE( :start_date, 'DD-MON-YYYY'))
/ 7
ELSE 0
END -- week_nbr
ORDER BY week_nbr
;Notice I simplified the computation of week_nbr.
Some other people have asked questions about hot dog stands recently.
I'm curious; is this from a course? If so, where? What is the textbook (if any)?
Thanks. -
TS4268 I need help getting my face time and imessage to work.
I need help getting my face time and imessage to work. It is saying wating for activation. I just got my iphone 5 2 days ago. I have reset it from the phone and from itunes on the computer, made sure I'm attached to wifi.
The 3 basic troubleshooting steps are these in order: 1. Restart your iphone 2. Reset your settings/iphone 3. Restore your iphone. Since your iphone is only a couple of days old, you should backup your device before restoring. If you don't have anything on your iphone that you care to lose, then simply restoring without a backup is fine. A quick reset of pressing the sleep/wake button (top of iphone) and your home button simultaneously and holding it until the silver Apple logo appears.
-
Now i have tryied everything i need help getting premier pro trial real help pls!
now i have tryied everything i need help getting premier pro trial real help pls!
Hi,
Are you facing issues installing Premiere pro trial?
Please mention your operating system.
Error(If you're getting any)
Thank you,
Mohd Naseem -
TS1398 I need help getting connected to our home wifi.
I need help getting connected to our home wifi. I've reset network settings, iPhone, and router but the error "unable to join network" keeps coming up. I also double checked the password. Please help
Other possibilities:
Your router firmware is out of date. Check the manufacturer's website for an update
You have MAC (Media Access Control) filtering enabled on the router, that restricts access to "known" devices and the new iPhone is not on the table of known devices
Your router has a setting limiting the number of simultaneous allowed devices
Your routers SSID ("name") is still the default (e.g., LINKSYS, DLINK, NETGEAR, etc). Your phone has encountered other routers with the same name as you have traveled, and the phone is confused as to which router is the real one. If your router's name is still the default you should change it. -
Need help getting contacts from outlook 2010
I need help getting my contacts from outlook 2010 to icloud and/or my iphone. I have icloud up and logged in on pc. when I go to a contact to import it says there was a problem reading the vcard. any help is welcomed.
I do have the latest version of DTM and working with OUTLOOK 2000. I know it is old, but it still does what I need it to. I did try to uninstalland reinstall. No luck. The only options listed to sync are yahoo, outlook express, and ASCII inport/export. Obviously it is not syncing my other data either, but it is my contacts that I am most concerned with at this point. The calader would be nice too! Any other suggestions, or is my outlook too old to sync?
-
Need help getting from 10.5.8 to 10.6.
need help getting from 10.5.8 to 10.6. i know i'm late to the game!
If you are not sure of what you are doing,If you are worried about losing anything when doing a major systems upgrade/update,
Before embarking on a major OS upgrade, it would be wise, advisable and very prudent if you backup your current system to an external connected and Mac formatted Flash drive OR externally connected USB, Thunderbolt or FireWire 800, Mac formatted hard drive. Then, use either OS X Time Machine app to backup your entire system to the external drive OR purchase, install and use a data cloning app, like CarbonCopyCloner or SuperDuper, to make an exact and bootable copy (clone) of your entire Mac's internal hard drive. This step is really needed in case something goes wrong with the install of the new OS or you simply do not like the new OS, you have a very easy way/procedure to return your Mac to its former working state.
Older version of CarbonCopyCloner found here.
http://mac.filehorse.com/download-carbon-copy-cloner/2734/
Older versions of SuperDuper can be found on the SuperDuper Website and Homepage.
http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html
Then, determine if your Mac meets ALL minimum system install requirements.
Mac OS X v10.6 Snow Leopard system requirements
Purchased Installer disc here.
http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
To install Snow Leopard for the first time, you must have a Mac with:
An Intel processor
An internal or external DVD drive, or DVD or CD Sharing
At least 1 GB of RAM (additional RAM is recommended)
A built-in display or a display connected to an Apple-supplied video card supported by your computer
At least 5 GB of disk space available, or 7 GB of disk space if you install the developer tools.
In addition, see this discussion for more relevant info that you may need if you have any other questions or issues.
Snow Leopard upgrade - keeps Photoshop? -
TS1538 i need help because i need help getting my ipod touch to connect to windows vista and
i need help getting my ipod touch to connect to windows because it keeps saying udb device not recognized and i tr\]ied restarting the settings!!!!!
Have you tried here:
iOS: Device not recognized in iTunes for Windows -
I need help getting itunes on my new computer. old one crashed
My old computer crashed, I downloaded iTunes on my new computer and need help getting all of my stuff on it that I had. I did 'home share' to see if that worked, and it didnt.
Also, on my old computer, when I synced my iPad & my husbands iPod, it didnt sync any music or podcasts, no videos-and i went through each category seperately to sync it and it didnt work. So I can't sync my devices to the new iTunes bc not everything is on there that i have purchased.It has always been very basic to always maintain a backup copy of your comuter for just this occasion. Use your backup copy to put everything on the new computer.
If for some reason you have failed to maintain a backup, not good, then you can redownload some itunes purchases in some countries:
Downloading past purchases from the App Store, iBookstore, and iTunes Store -
I need help getting my OS X Mavricks download to work and start downloading but it wont work
i need help getting my OS X Mavricks download to work and start downloading but it wont work
Contact http://www.apple.com/support/mac/app-store/contact/. They're responsible for getting this abysmal delivery system to work.
-
I need help getting my os x mountain lion to work for my pro tools
I need help getting my os x mountain lion to work for my pro tools
Since you provide no details I can do nothing but guess, so perhaps this will help:
http://avid.force.com/pkb/articles/en_US/how_to/Upgrading-to-Mac-OS-10-8?popup=t rue&NewLang=en&DocType=1080
http://avid.force.com/pkb/articles/en_US/compatibility/Avid-Software-and-Mac-OS- X-10-8?popup=true&NewLang=en&DocType=1083
If you continue to have problems, you probably should contact Avid support.
Regards.
Maybe you are looking for
-
APP store,Mail,QT,Preview etc quit every time I try to open them
A few weeks ago i created a new account for the other half on my iMac. At the time we had problems with permissions etc and fixed all of that.. It has been working fine but in the last few days the original (admin) account has stopped working properl
-
help my computer crashed and i want my music back from my phone
-
Itunes says no room for music on iphone but there is 26gb free!
I have an ipod with about 14 gb of music on it, just bought an iphone (32gb). My apps transfered OK but itunes refuses to transfer any music saying there is no room although the iphone claims 26gb free..
-
iWork installs successfully but then when I try to open it, I get the following Process: Numbers [1131] Path: /Applications/iWork '09/Numbers.app/Contents/MacOS/Numbers Identifier: com.apple.iWork.Numbers Version: ???
-
Updating mac pro 10.4.11
Hi folks. I have a question: can I update my version 10.4.11 to a higher version and if yes how? Also, I am a little novice....and I do not know if mac pro 10.4.11 uses tiger or leopard. Please advise. Thanks