Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

hellp me with my homwork

Name: Anonymous 2011-03-16 23:12

A company is supplying 4 types of soft drinks like Pepsi, Sprite, Orange Soda and a new lemon drink to 100 stores. The company has a new promotion which gives a free dozen of lemon drink for every 24 dozen of Pepsi, for every 30 dozen of Sprite and every 10 dozen of Orange soda. The company provides many discounts on their sales which can be listed as follows:
>2% discount if sale >= $10,000
>3% discount if sale >= $20,000
2% additional discount if the bill is paid within 30 days (counter loop)
10 dozens of free lemon drinks if the total purchased dozen is >= 1000.

Write a program in Java to read the order for the number and type of soft drinks, soda cost, shipping and handling cost, date of invoice, payment date. Then compute the total discount, total number dozens of soda, total number of free soda received, shipping cost, and total cost.
For this problem use the following data
5000 doz Pepsi
6000 doz Sprite
7500 doz orange
$ 1.50 per dozen
$ .25 shipping cost per dozen.

use extract and if else loops

Name: Anonymous 2011-03-16 23:14

or at least tell me what i basically should do

Name: Anonymous 2011-03-16 23:16

>>2
tell yuor teacher that java sucks and you don't care about job security.

Name: Anonymous 2011-03-16 23:17

ok good idea

Name: Anonymous 2011-03-16 23:20

>>2
You should write a program in Java to read the order for the number and type of soft drinks, soda cost, shipping and handling cost, date of invoice, payment date.  Then you should compute the total discount, total number dozens of soda, total number of free soda received, shipping cost, and total cost.

Name: Anonymous 2011-03-16 23:20

so no one on here knows java orrrrrr

Name: Anonymous 2011-03-16 23:21

>>5
>>5
u fargot, i meaaaaaaant like pseudocode

Name: Anonymous 2011-03-16 23:24

The purpose of OOP is to act as a "herding mechanism" that keeps mediocre programmers in mediocre organizations from "doing too much damage". This is at the expense of slowing down productive programmers who know how to use more powerful and more compact techniques.

Now demand an explanation from your teacher as to why is he trying to keep a nigga down with Java

Name: Anonymous 2011-03-16 23:27


            ∧_∧   / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
          ( ´∀`) < VIVA MEOWXICO! and ALBERTOO DEL RRRIO!
        /    |    \
       /       .|      ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
       / "⌒ヽ |.イ |
   __ |   .ノ | || |__
  .    ノく__========つ--
   _((_________\
    ̄ ̄ヽつ ̄ ̄ ̄ ̄ ̄ ̄ | | ̄

Name: Anonymous 2011-03-17 0:05

The point of assignments like this isn't to teach you anything about programming, but get you comfortable with the syntax enough that you're not making silly mistakes all the time..
that being said, i'll gladly do your homework for you... in PHP

Name: Anonymous 2011-03-17 0:07

ENTERPRISE

Name: Anonymous 2011-03-17 1:31

Have you read your sicp today?
I obviously have not.


#!/usr/bin/php -f
<?php
class order
{
// amounts in dozens
    public $total = 0;
    public $shitrape = 0;
    public $costper = 0;
    public $rebatesapplyd = False;
    public $amounts = array("pepsi" => 0, "sprite" => 0, "orange" => 0, "lemon"=>0);
    function totamount() {
        $count = 0;
        foreach ($this->amounts as $amount) { $count += $amount; }
        return $count;
    }
    function getRewards() {
        $freelemons=0;
        if ($this->totamount() >= 1000) { $freelemons += 10; }
        $freelemons += floor($this->amounts['pepsi']/24) + floor($this->amounts['sprite']/30) + floor ($this->amounts['orange']/10);
        return $freelemons;
    }
    function applyRebates() {

        if (!$this->rebatesapplyd) {
            if ($this->total >= 20000)
            {
                $this->total *= 0.97;
                $this->rebatesapplyd=True;
            }
            else if ($this->total >= 10000)
            {
                $this->total *= 0.98;
                $this->rebatesapplyd=True;
            }
        $this -> rebatesapplyd = True;
        }
    }
    function getTotal() {
        $total = 0;
        $total += $this->totamount()*$this->costper;
        $this->applyRebates();
        $this->amounts['lemon'] = $this->getRewards();;
        $total += $this->totamount()*$this->shitrape;
        return $total;
    }
}
$o = new order();
$o->costper = 1.5;
$o->shitrape = .25;
$o->amounts['pepsi']=5000;
$o->amounts['orange']=7500;
$o->amounts['sprite'] =6000;
print $o->getTotal();
?>

Name: Anonymous 2011-03-17 1:41

PHP has classes? I wonder if they are half as broken as the rest of the language.

Name: Anonymous 2011-03-17 2:12

>>1
if else loops
What?

Name: Anonymous 2011-03-17 2:40


(require srfi/1)
(require srfi/19)

(define (date-string->time-monotonic date-string)
  (date->time-monotonic (string->date date-string "~d/~m/~Y")))

(define (days->time-duration days)
  (time-difference (date->time-monotonic (make-date 0 0 0 0 days 0 0 0))
                   (date->time-monotonic (make-date 0 0 0 0 0 0 0 0))))

(define (order number-drinks-type cost shipping invoice-time-monotonic payment-time-monotonic)
  (letrec ((number
            (fold + 0 (map car number-drinks-type)))
           (free-lemon
            (+
             (fold + 0 (map (lambda (order-item)
                              (cond
                                ((eq? (cadr order-item) 'pepsi)  (floor (/ (car order-item) 24)))
                                ((eq? (cadr order-item) 'sprite) (floor (/ (car order-item) 30)))
                                ((eq? (cadr order-item) 'orange) (floor (/ (car order-item) 10)))
                                (else 0)))
                            number-drinks-type))
            
             (if (> number 1000)
                 10
                 0)))
          
           (discount
            (+ (cond
                 ((>= (* number cost) 10000) (* -0.2 (* number cost)))
                 ((>= (* number cost) 20000) (* -0.3 (* number cost)))
                 (else 0))
              
               (if (time<=? (time-difference payment-time-monotonic invoice-time-monotonic)
                            (days->time-duration 30))
                   (* -0.2 (* number cost))
                   0))))
   
    (list discount
          (+ number free-lemon)
          free-lemon
          (* shipping (+ number free-lemon))
          (+ (* number cost) discount (* shipping (+ number free-lemon))))))

(order '((5000 pepsi)
         (6000 sprite)
         (7500 orange))
       1.5 0.25 (date-string->time-monotonic "01/01/2011") (date-string->time-monotonic "20/01/2011"))

Name: Anonymous 2011-03-17 2:48


<html>
i am programming in html
how do i do for loop
</html>

Name: Anonymous 2011-03-17 2:56

>>16
do i do for loop
VALID FORTH CODE

Name: Anonymous 2011-03-17 3:40

>>16
`(html ,(loop ...))

Name: Anonymous 2011-03-17 3:42

BTW, Lisp is HTML, but you don't have to close tags and you can define your own tags.

Name: Anonymous 2011-03-17 4:52

>>12
>$o->amounts['pepsi']=5000;
$o->amounts['orange']=7500;
$o->amounts['sprite'] =6000;

[@o.amounts "pepsi"=5000 "orange"=7500 "sprite"=6000]

"Code Less, Create More" -- Troll-tech.

Name: Anonymous 2011-03-17 4:53

>>12
$o->amounts['pepsi']=5000;
$o->amounts['orange']=7500;
$o->amounts['sprite'] =6000;

[@o.amounts "pepsi"=5000 "orange"=7500 "sprite"=6000]

"Code Less, Create More" -- Troll-tech

Name: Anonymous 2011-03-17 5:38

OP HERE:::::   fuck, well im doing it on my own but i dont know how the fuck i do dates.... fffffffffffffffffuuuuuuuuuuuuuuuuuu

Name: Anonymous 2011-03-17 5:50

>>21
"Code Less, Create More" -- Troll-tech
"We're giving up on Qt" -- Nokia

Name: Anonymous 2011-03-17 6:23

>>23
because seppless sucks at being code less

Name: Anonymous 2011-03-17 9:36

>>21
: CODE LESS CREATE MORE ;

VALID FORTH CODE

Name: Anonymous 2011-03-17 14:22

what?

Name: Anonymous 2011-03-17 14:25

>>59
Why? I want to know C  , not use it. There's a difference.

Name: Anonymous 2011-03-17 14:31

where can I find a good Scheme compiler?

Name: Anonymous 2011-03-17 14:33

It's better like this

Name: Anonymous 2011-03-17 14:36

>>30
Oh, I thought it was the name of that Linux distro that a bunch of 7chan idiots started. They seem to want "Mudkips" and "hacking tools" in it.

I can't find the link right now and I really don't want to search for something like that.

Don't change these.
Name: Email:
Entire Thread Thread List