Answered step by step
Verified Expert Solution
Question
1 Approved Answer
how can you write this code using python? Data files allow the programmer to store and retrieve data for later use in the same or
how can you write this code using python?
Data files allow the programmer to store and retrieve data for later use in the same or other applications Data files are common to all programming languages. A few things to remember about data files . They are separate, "external" files to the calling source code application .Unless specified, all programming languages assume the data file is on the same drive and within the same subdirectory as the calling source code application (known as "pathing") Data files can be read from (data copied for use in the application) or written to (new records added) Data records are comprised of one or more fields and appear as "one separate line All records of the same data file must have the same number of fields Fields can be comprised of both numeric and string text but the numeric values must be stored as a "string text" in the data file All fields must be the same format holding the same data types for all the records The programmer must know what each field "represents" in the logic Records are read, "one line or one record" at a time sequentiall There are a finite number of records but your logic cannot be sure of that exact number of records (Why? That data file may have had new records added or existing records deleted before your application accessed it). Standard tactic is to keep reading until you find the "End of File" . . . . . marker Your company sells three products 1. Widgets $10.55 per unit 2. Gidgets @ S7.30 per unit 3. Doodads S5.25 per unit Quantities must be positive integers. Zero is an acceptable quantity (i.e. that customer did not order any The record is comprised of four fields Customer ID (2 letters followed by 3 digits such as AF101) Quantity of Widgets ordered Quantity of Gidgets ordered Quantity of Doodads ordered 1. 2. 3. 4. The application allows the user to Read and display the data file's records Wre a new record (i.e. order) to the data file Quit Run the application until the user wants to quit (i.e. some sort of while loop). Break the read and write capabilities into functionsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started