Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Videos

Question
Book Icon
Chapter 6, Problem 14PE
Program Plan Intro

Program to display sum of square of the integer value of the string values

Program plan:

  • The function named “toNumbers()” is defined and inside the “toNumbers()”,
    • Initialize the for loop that ranges till the length of the array
      • The variable “strList[]” stores the integer value of the string values in the array.
      • Return the value stored in the variable “strList”
  • The function named “squareEach()” is defined and inside the “squareEach()”,
    • Initialize the for loop that ranges till the length of the array
      • The required variable is declared and stores the array of numbers that have been squared.
      • Return the value stored in the variable “num”
  • The function named “sumList()” is defined and inside the “sumList()”,
    • Declare the required variable
    • Initialize the for loop that ranges till the length of the array
      • The variable “y” stores the sum of the numbers in the array.
      • Return the value stored in the variable “y”
  • In the “main()” function,
    • Generate a prompt to take the user input.
    • Open the text file from which the contents have to be taken as input.
    • Declare the required array variable.
    • Initialize a for loop to read the lines from the file as user input.
    • Call the method named “toNumbers()” to get the integer value of the string.
    • Call the method named “squareEach()” to square the numbers in the given array.
    • Call the method named “sumList()” to square the numbers in the given array.
    • Print the output value stored in the variable “z”.
  • Call the function “main()”.

Blurred answer
Students have asked these similar questions
The images I have uploaded are the part 1 to 4 and questions below are continue on the questions uploaded 5. C++ Class Template with Method Stubs #pragma once #include <iostream> #include <string> #include <stdexcept> #include <vector>   template <typename T> class HashTable { private:     struct Entry {         std::string key;         T value;         bool isOccupied;         bool isDeleted;         Entry() : key(""), value(), isOccupied(false), isDeleted(false) {}     };       Entry* table;     size_t capacity;     size_t size;     double loadFactorThreshold;           size_t customHash(const std::string& key) const {         size_t hash = 5381;         for (char c : key) {             hash = ((hash  <<  5) + hash)  +  c;         }         return hash;     }       size_t probe(const std::string& key, bool forInsert = false) const;     void resize();   public:     // Constructor     HashTable(size_t initialCapacity = 101);         // Big…
this project is NOT for graded(marks) purposes, please help me with the introduction. give me answers for the project. i will include an image explaining everything about the project.
Java Graphics (Bonus In this lab, we'll be practicing what we learned about GUIs, and Mouse events. You will need to implement the following: A GUI with a drawing panel. We can click in this panel, and you will capture those clicks as a Point (see java.awt.Point) in a PointCollection class (you need to build this). The points need to be represented by circles. Below the drawing panel, you will need 5 buttons: O о о ○ An input button to register your mouse to the drawing panel. A show button to paint the points in your collection on the drawing panel. A button to shift all the points to the left by 50 pixels. The x position of the points is not allowed to go below zero. Another button to shift all the points to the right 50 pixels. " The x position of the points cannot go further than the You can implement this GUI in any way you choose. I suggest using the BorderLayout for a panel containing the buttons, and a GridLayout to hold the drawing panel and button panels. Regardless of how…
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License