首页 > 其他分享 >Control Statements and Jumps

Control Statements and Jumps

时间:2024-10-22 19:03:21浏览次数:1  
标签:Control Statements pounds hr Jumps per should program shipping

Lab 04: Control Statements and Jumps-2024.10.15

  1. Write a program that requests the hours worked in a week and then prints the grosspay, the taxes, and the net pay. Assume the following:
  1. Basic pay rate = $10.00/hr
  2. Overtime (in excess of 40 hours) = time and a half
  3. Tax rate: #15% of the first $300, 20% of the next $150, 25% of the restUse #define constants, and don’t worry if the example does not conform to currenttax law.
  1. Modify assumption a. in exercise 1 so that the program presents a menu of pay ratesfrom which to choose. Use a switch to select the pay rate. The beginning of a run shouldlook something like this:

*********************************************************************

Enter the number corresponding to the desired pay rate or action:

  1. 1) $8.75/hr 2) $9.33/hr 3) $10.00/hr 4) $11.20/hr 5) quit

*********************************************************************

The program should request the hours worked if choices 1 through 4 are selected. The

program should recycle until 5 is entered. If something other than choices 1 through 5is entered, the program should remind the user what the proper options are and thenrecycle. Use #define constants for the various earning rates and tax rates.

  1. Write a program that accepts a positive integer as input and then displays all theprime numbers smaller than or equal to that number.
  1. The ABC Mail Order Grocery sells artichokes for 代 写Control Statements and Jumps  $2.05 per pound, beets for $1.15per pound, and carrots for $1.09 per pound. It gives a 5% discount for orders of $100or more before adding shipping costs. It charges $6.50 shipping and handling for anyrder of 5 pounds or under, $14.00 shipping and handling for orders over 5 pounds andunder 20 pounds, and $14.00 plus $0.50 per pound for shipments of 20 pounds or more.Write a program that uses a switch statement in a loop such that a response of a lets theuser enter the pounds of artichokes desired, b the pounds of beets, c the pounds ofcarrots, and q allows the user to exit the ordering process. The program should keeptrack of cumulative totals. That is, if the user enters 4 pounds of beets and later enters5 pounds of beets, the program should report 9 pounds of beets. The program thenshould compute the total charges, the discount, if any, the shipping charges, and thetotal. The program then should display all the purchase information: the cost per pound,

the pounds ordered, and the cost for that order for each vegetable, the total cost of theorder, the discount (if there is one), the shipping charge, and the total of all the charges.Submission Requirements: Use a folder to include all source files for each question.For example, this lab contains three questions, so you need to create three folders, eachof which needs to save source files for each question. Then, you need to submit thecompressed file containing these folders to the Moodle platform.

标签:Control,Statements,pounds,hr,Jumps,per,should,program,shipping
From: https://www.cnblogs.com/goodlunn/p/18493525

相关文章

  • 蓝牙Controller错误代码全面概览
    目录一、引言二、蓝牙错误代码概览三、错误代码详细描述3.1.UNKNOWNHCICOMMAND(0x01)3.2.UNKNOWNCONNECTIONIDENTIFIER(0x02)3.3.HARDWAREFAILURE(0x03)3.4.PAGETIMEOUT(0x04)3.5.AUTHENTICATIONFAILURE(0x05)3.6.PINORKEYMISSING(0x06)3.7.M......
  • WPF - 集成HandyControl UI组件库
    WPF-集成HandyControlUI组件库 环境:net6+wpf+ HandyControl  一.创建项目   二.安装  NuGet包dotnetaddpackageHandyControl  三. 引入HandyControl资源字典 在你的WPF项目中的 App.xaml 或主题文件中1.引入HandyControl资源字典......
  • Linux DMA Engine framework(3)_dma controller驱动
    1.前言本文将从provider的角度,介绍怎样在linuxkerneldmaengine的框架下,编写dmacontroller驱动。2.dmacontroller驱动的软件框架设备驱动的本质是描述并抽象硬件,然后为consumer提供操作硬件的友好接口。dmacontroller驱动也不例外,它要做的事情无外乎是:1)抽象并控制DMA控......
  • MySQL 5.7 Reference Manual Optimizing SQL Statements(翻译)
    使用Kimi翻译文档地址:https://dev.mysql.com/doc/refman/5.7/en/optimize-overview.html目录8.2OptimizationOverview8.2.1优化SELECT语句8.2.2优化子查询、派生表和视图引用8.2.3优化INFORMATION_SCHEMA查询8.2.4优化数据变更语句8.2.5优化数据库权限8.2.6其他优化技巧......
  • DreamMesh4D: Video-to-4D Generation with Sparse-Controlled Gaussian-Mesh HybridR
    目录一、概述二、前置知识1、分数蒸馏采样 2、LBS 3、DQS4、EucDist和GeoDist算法三、相关工作1、三维生成2、4D表示3、4D生成四、DreamMesh4D1、静态阶段 2、动态阶段-可变形图建立 3、动态阶段--自适应可变蒙皮算法 一、概述    该论文提出了......
  • Dungeon Crawler Grid Controller 地牢移动控制器
    GridController是一种基于网格的第一人称控制器,易于设置,但功能强大且通用。不需要脚本。非常适合地牢爬虫。特征:实时或回合制运动平稳移动或瞬间捕捉到网格位置支持倾斜、下降和蹲伏自由外观相机可选头部摆锤迷你地图用于脚步声和障碍物反弹声的表面系统触发器和与......
  • java代码生成器(controller,service,mapper)
    packagecom.cn.codeGenerator;importjava.awt.*;importjava.io.File;importjava.io.FileWriter;importjava.io.IOException;importjava.sql.*;importjava.util.ArrayList;importjava.util.List;publicclassCodeGenerator{privatestaticfinalStri......
  • 【AI绘画】Stable Diffusion实战ControlNET插件(让小姐姐摆出你要的pose!)
    大家好我是安琪!SD插件ControlNET的诞生,无法自定义姿势成为过去,自定义姿势;根据线稿、骨骼、其他图片生成全新的图,AI绘图自主可控;包括边缘检测,深度信息估算;姿态,手势检测;分割等等场景:个人pose图,模特换装;装修出图;设计草图快速复原;颜色快速更换等等此扩展用于AUTOMATIC1111的......
  • DDCDesktopDeliveryControl的安装
    DDCDesktopDeliveryControl的安装 ......
  • ros2_control 架构分析(2)-HardwareInterface
    1.介绍在ROS2_control框架中,hardware模块负责与物理硬件进行直接通信。它抽象了三类硬件:system、sensor和actuator,分别对应复杂的系统、仅输出数据的传感器和仅接收输入的执行器。2.类与接口在ROS2_control中,system、sensor和actuator作为三个核心类存在被上层调用,它们各自......