Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Full-Stack Techies vs Toptal: Which Is Better for React.js Outsourcing?

      July 3, 2025

      The AI productivity paradox in software engineering: Balancing efficiency and human skill retention

      July 2, 2025

      The impact of gray work on software development

      July 2, 2025

      CSS Intelligence: Speculating On The Future Of A Smarter Language

      July 2, 2025

      Your Roku has secret menus and screens – here’s how to unlock them

      July 3, 2025

      Add Paramount+, STARZ, and more to your Prime Video account for $0.99 a month – here’s how

      July 3, 2025

      My new favorite keychain accessory gives me 2TB of SSD storage instantly

      July 3, 2025

      HP’s latest OmniBook finally sold me on the 2-in-1 form factor (and it’s on sale)

      July 3, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Simplifying Stream Handling with Laravel’s resource Method

      July 3, 2025
      Recent

      Simplifying Stream Handling with Laravel’s resource Method

      July 3, 2025

      Intelligent Parsing and Formatting of Names in PHP Applications

      July 3, 2025

      This Week in Laravel: Cursor Rules, Nightwatch Review, and Race Conditions

      July 3, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft confirms Windows 11 KB5060829 issues, but you can safely ignore it

      July 3, 2025
      Recent

      Microsoft confirms Windows 11 KB5060829 issues, but you can safely ignore it

      July 3, 2025

      Hash Calculator – calculates around 50 cryptographic hashes of strings and files

      July 3, 2025

      Rilasciato Thunderbird 140 ESR: Un’attenzione alle esigenze aziendali

      July 3, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: A Steady Ship

    CodeSOD: A Steady Ship

    April 10, 2025
    CodeSOD: A Steady Ship

    You know what definitely never changes? Shipping prices. Famously static, despite all economic conditions and the same across all shipping providers. It doesn’t matter where you’re shipping from, or to, you know exactly what the price will be to ship that package at all times.

    Wait, what? You don’t think that’s true? It must be true, because Chris sent us this function, which calculates shipping prices, and it couldn’t be wrong, could it?

    public double getShippingCharge(String shippingType, bool saturday, double subTot)
    {
        double shCharge = 0.00;
        if(shippingType.Equals("Ground"))
        {
            if(subTot <= 29.99 && subTot > 0)
            {
                shCharge = 4.95;
            }
            else if(subTot <= 99.99 && subTot > 29.99)
            {
                shCharge = 7.95;
            }
            else if(subTot <= 299.99 && subTot > 99.99)
            {
                shCharge = 9.95;
            }
            else if(subTot > 299.99)
            {
                shCharge = subTot * .05;
            }              
        }
        else if(shippingType.Equals("Two-Day"))
        {
            if(subTot <= 29.99 && subTot > 0)
            {
                shCharge = 14.95;
            }
            else if(subTot <= 99.99 && subTot > 29.99)
            {
                shCharge = 19.95;
            }
            else if(subTot <= 299.99 && subTot > 99.99)
            {
                shCharge = 29.95;
            }
            else if(subTot > 299.99)
            {
                shCharge = subTot * .10;
            }              
        }
        else if(shippingType.Equals("Next Day"))
        {
            if(subTot <= 29.99 && subTot > 0)
            {
                shCharge = 24.95;
            }
            else if(subTot <= 99.99 && subTot > 29.99)
            {
                shCharge = 34.95;
            }
            else if(subTot <= 299.99 && subTot > 99.99)
            {
                shCharge = 44.95;
            }
            else if(subTot > 299.99)
            {
                shCharge = subTot * .15;
            }              
        }
        else if(shippingType.Equals("Next Day a.m."))
        {
            if(subTot <= 29.99 && subTot > 0)
            {
                shCharge = 29.95;
            }
            else if(subTot <= 99.99 && subTot > 29.99)
            {
                shCharge = 39.95;
            }
            else if(subTot <= 299.99 && subTot > 99.99)
            {
                shCharge = 49.95;
            }
            else if(subTot > 299.99)
            {
                shCharge = subTot * .20;
            }              
        }                                      
        return shCharge;
    }
    

    Next you’re going to tell me that passing the shipping types around as stringly typed data instead of enums is a mistake, too!

    [Advertisement]
    Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous Articleautoenv provides directory based environments
    Next Article 8 Best Free and Open Source Terminal-Based Flashcard Tools

    Related Posts

    News & Updates

    Your Roku has secret menus and screens – here’s how to unlock them

    July 3, 2025
    News & Updates

    Add Paramount+, STARZ, and more to your Prime Video account for $0.99 a month – here’s how

    July 3, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    quickenv is an unobtrusive environment manager

    Linux

    RTX 5060 Ti gets official support in NVIDIA’s newest driver, stability concerns are addressed

    News & Updates

    CVE-2025-4100 – Nautic Pages WordPress Stored Cross-Site Scripting

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-49509 – Roland Beaussant Audio Editor & Recorder Missing Authorization Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    Best Chest Doctor Near Me | Parthiv Lung Care

    May 3, 2025

    Post Content Source: Read More 

    CloudBees Unify, YugabyteDB adds support for DocumentDB, and more — SD Times Daily Digest

    May 20, 2025

    Multimodal AI Needs More Than Modality Support: Researchers Propose General-Level and General-Bench to Evaluate True Synergy in Generalist Models

    May 12, 2025

    AI in Finance: Smarter Fraud Detection, Risk Analysis & Algorithmic Trading💰

    May 20, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.