合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

        代做TUCH.UB25、代寫python語言程序
        代做TUCH.UB25、代寫python語言程序

        時間:2024-10-20  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



        TECH.UB.25: Intro to Python Programming: Assignment # 4
         
        Scenario:  Campus Pizza is really taking off and your co-founders love the programs you have built.  They want you to build an object-oriented program for their beverages.   Campus pizza has two beverage options: Soda from the soda fountain, and home-made lemonade which is available as sweetened or unsweetened.   Both beverages are $1.50 for a small, $1.75 for a medium and $2.00 for a large.  
         
        Program Guidelines: 
        1) Superclass: Create a superclass called “Beverage” that has two attributes: “size” and “price”.  “Beverage” should also have a method called “display” that prints out a statement of the size and price of the drink.  
         
        2) Subclasses: 
        a) Soda Subclass: Create a subclass “Soda” that inherits all the attributes and methods of Beverage.  
        b) Lemonade Subclass: Create a subclass “Lemonade” that inherits all the attributes of subclass, but add an attribute called “sugar” for whether the customer wants the lemonade sweetened or unsweetened.  Additionally, edit the display function so that it also shows the sugar status.   
         
        3) Functions: Outside of the classes, create the following functions:
        a) Title: Create a function called “title” that prints the title “The Beverage Program”  
        b) Closing: Create a function called “closing” that prints the number of drinks created and thanks them for using the program 
        c) Getting Size:  Create a function called “get_size” that asks the user what size beverage the user wants (S, M, L) and assigns it to a variable called “size_input”.   If the user enters an invalid value, assume the size is a Small.  Based on their input, return a variable called “size” from the function. 
        d) Get Sugar:  Create a function called “get_sugar” that asks the users who want a lemonade whether they would like their lemonade Sweetened or Unsweetened (S or U) and assigns it to a variable called “sugar_input”.  Return a variable called sugar with the phrase “Sweetened or Unsweetened” based on user status.  If the user doesn’t put an “S”, default to Unsweetened.   
        e) Get Price:  Create a function called “get_price” that returns a variable called “price” based on the size of the drink.  
         
        4) Main: 
        - Nest all your functions inside a main function. 
        - Start by creating an empty list called “drinks.” 
        - Create a loop that allows the user to create orders for multiple drinks.  
        - Ask the user to create a drink by asking for the drink type, “S” for soda, “L” for lemonade, “0” to exit, and then proceed to get the size of the drink. (The reason this needs to be inside the main function vs. its own function is because the “0” will break the main program loop). 
        - If the user enters an incorrect value for the drink type or size, end the program and ask them to run it again.  
        - If the drink is a lemonade, ask the user if they would like it sweetened “S” or unsweetened “U”. If the user enters something else, assume it is unsweetened.  
        - After the user has created all of the drink, assign it to an object.  Add this object to the “drinks” list.  
        - When the user enters “0” and is done creating new drinks,  print all the objects in the “drinks” list.  For each drink in the list “drinks”, show the drink number, type, price and sweetness (for lemonades).  
        - Finally, close the program and show the user the number of drinks they created.   
         
        Program Console: 
        ______________________
        The Beverage Program
         
        Soda or a lemonade? Enter S, L or 0 for no drinks: S
        What size would you like?  Enter S, M or L: M
        Would you like to create another drink? y/n? y
         
        Soda or a lemonade? Enter S, L or 0 for no drinks: Q
        Incorrect drink type.  Please enter S or L: L
        What size would you like?  Enter S, M or L: L
        Sweetened or Unsweetened?  Enter S or U: U
        Would you like to create another drink? y/n? y
         
        Soda or a lemonade? Enter S, L or 0 for no drinks: L
        What size would you like?  Enter S, M or L: S
        Sweetened or Unsweetened?  Enter S or U: S
        Would you like to create another drink? y/n? n
         
        Drink 1: Soda
        Size: Medium   Price: $1.75
         
        Drink 2: Lemonade
        Size: Large   Price: $2.00    Sugar: Unsweetened
         
        Drink 3: Lemonade
        Size: Small   Price: $1.50    Sugar: Sweetened
         
        You created 3 drink orders. Thanks for using this program!

        請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp






         

        掃一掃在手機(jī)打開當(dāng)前頁
      1. 上一篇:CE243程序代做、代寫C++編程語言
      2. 下一篇:代寫SCC.369、C++語言編程代做
      3. 無相關(guān)信息
        合肥生活資訊

        合肥圖文信息
        出評 開團(tuán)工具
        出評 開團(tuán)工具
        挖掘機(jī)濾芯提升發(fā)動機(jī)性能
        挖掘機(jī)濾芯提升發(fā)動機(jī)性能
        戴納斯帝壁掛爐全國售后服務(wù)電話24小時官網(wǎng)400(全國服務(wù)熱線)
        戴納斯帝壁掛爐全國售后服務(wù)電話24小時官網(wǎng)
        菲斯曼壁掛爐全國統(tǒng)一400售后維修服務(wù)電話24小時服務(wù)熱線
        菲斯曼壁掛爐全國統(tǒng)一400售后維修服務(wù)電話2
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國24小時客服熱線
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國24小時
        海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
        海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
        合肥機(jī)場巴士4號線
        合肥機(jī)場巴士4號線
        合肥機(jī)場巴士3號線
        合肥機(jī)場巴士3號線
      4. 短信驗證碼 酒店vi設(shè)計

        国产精品亚洲高清一区二区| 亚洲精品专区在线观看| 精品国产一区二区三区2021| 国产精品成人在线| 国产成人AV无码精品| 精品动漫一区二区无遮挡| 久久99精品国产99久久6| 亚洲日韩乱码久久久久久| 97久久精品国产成人影院| xxx国产精品xxx| 一本色道久久88—综合亚洲精品 | 国产精品美女久久久久浪潮AV| 中日精品无码一本二本三本| 国产精品扒开腿做爽爽爽的视频| 亚洲国产精品婷婷久久| 永久免费精品影视网站| 一本一本久久a久久综合精品蜜桃| 久久久无码精品亚洲日韩京东传媒| 国产精品无码国模私拍视频| 日韩精品中文字幕在线观看| 网友自拍区视频精品| 国产精品无码成人午夜电影| 中文日韩亚洲欧美制服| 日韩精品无码久久一区二区三| 精品国产福利一区二区| 中文字幕在线亚洲精品| 中文字幕一区日韩精品| 日韩精品视频在线观看免费 | 自拍偷在线精品自拍偷无码专区 | 伊人久久国产精品| 日韩人妻无码精品专区| 国产成人精品天堂| 久久久久久精品免费看SSS| 亚洲热线99精品视频| 97人妻精品全国免费视频| 国产在线高清精品二区| 精品999久久久久久中文字幕| 亚洲精品成a人在线观看| 午夜精品久久影院蜜桃| 国产精品午夜免费观看网站| 精品国产呦系列在线观看免费|