CSE 461 Project I The first part of this project

CSE 461 Project I

The first part of this project requires that you implement a class that will be used to simulate a disk drive. The disk drive will have numberofblocks many blocks where each block has blocksize many bytes. The interface for the class Sdisk should include :

Class Sdisk

{

public :

Sdisk(string diskname, int numberofblocks, int blocksize);

int getblock(int blocknumber, string& buffer);

int putblock(int blocknumber, string buffer);

int getnumberofblocks(); // accessor function

int getblocksize(); // accessor function

private :

string diskname;        // file name of software-disk

int numberofblocks;     // number of blocks on disk

int blocksize;          // block size in bytes

};

An explanation of the member functions follows :

  • Sdisk(diskname, numberofblocks, blocksize) This constructor incorporates the creation of the disk with the “formatting” of the device. It accepts the integer values numberofblocks, blocksize, a string diskname and creates a Sdisk (software-disk). The Sdisk is a file of characters which we will manipulate as a raw hard disk drive. The function will check if the file diskname exists. If the file exists, it is opened and treated as a Sdisk with numberofblocks many blocks of size blocksize. If the file does not exist, the function will create a file called diskname which contains numberofblocks*blocksize many characters. This file is logically divided up into numberofblocks many blocks where each block has blocksize many characters. The text file will have the following structure : Bytes 0 – blocksize-1Block 0Bytes blocksize – 2*blocksize-1Block 1Bytes 2*blocksize – 3*blocksize-1Block 2……Bytes ?-?Block numberofblocks-1
  • getblock(blocknumber,buffer) retrieves block blocknumber from the disk and stores the data in the string buffer. It returns an error code of 1 if successful and 0 otherwise.
  • putblock(blocknumber,buffer) writes the string buffer to block blocknumber. It returns an error code of 1 if successful and 0 otherwise.

IMPLEMENTATION GUIDELINES : It is essential that your software satisfies the specifications. These will be the only functions (in your system) which physically access the Sdisk. NOTE that you must also write drivers to test and demonstrate your program.

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Assume that upon your graduation, you accepted a position with

  Assume that upon your graduation, you accepted a position with the State’s Attorney’s office as a victim service coordinator. It is your job to assist victims of crime in completing their victim impact statements. In your new role, you have been asked to research the following questions to improve

Select one of the below-listed topics to use for your

Select one of the below-listed topics to use for your final project. Submit topic choice and a minimum of three references related to your topic to your instructor for approval. References should be five years or less since publication and be listed in the current APA Style. No Blog sites,

Business Management Major Develop a business plan for a start-u

Business Management Major Develop a business plan for a start-u p company that plans to sell a product or service in a local market, in a national market, or on the internet. Select one of your favorite products as a basis for the company or invent a product. See Business

Literature Review

 Literature Review Paper A literature review aims to highlight the current state of knowledge regarding a topic under study. Literature reviews are comprised of secondary sources and as such do not report any new or original experimental work. The main purpose of a literature review is to situate the current

List three examples of plagiarism and discuss how plagiarizing as

 List three examples of plagiarism and discuss how plagiarizing as a student affects the integrity of a baccalaureate degree, the public perception of the nursing profession, and evidence-based practice. Describe two things you will do to ensure academic integrity in your work.  FYI:  Using 200-300 words APA format with at

Why Study Political Science?

Why Study Political Science? Required Resources Read/review the following resources for this activity: • Textbook: Chapter 1, 2 • Lesson • Additional scholarly sources you identify through your own research Initial Post Instructions Identify why students should learn about political science. Use evidence (cite sources) to support your response from

Learning Goal: I’m working on a latin american studies multi-part

 Learning Goal: I’m working on a latin american studies multi-part question and need an explanation and answer to help me learn. respond to each of these questions in 3-4 sentences: 1. How did women participate in the development of modern Latin American nations? Describe how Dora Maria Téllez was an

Read Martin Luther King’s Letter from Birmingham Jail. You could

    Read Martin Luther King’s Letter from Birmingham Jail. You could also listen to MLK’s reading of the letter. Both files are in the MLK folder within Course Materials. You may also find background on the Birmingham Campaign in the MLK folder. Applying the Transformational Leadership and Authentic Leadership

Article: Enterprise Risk Management Integrating with Strategy and Performance Executive

Article: Enterprise Risk Management Integrating with Strategy and Performance Executive Summary. (2017, June). Retrieved from https://www.coso.org/Documents/2017-COSO-ERM-Integrating-with-Strategy-and-Performance-Executive-Summary.pdf Post: The reading this week discusses strategy and how ERM can be integrated with an organization’s overall strategy. Prepare a research paper on some of the various issues, protocols, methods, frameworks you found and discuss how –

Overview In this activity, you will have the opportunity to

  Overview In this activity, you will have the opportunity to examine how using critical analysis tools influences your interactions with others. You will also consider how the analysis of your example and area of popular culture might have turned out differently if you looked at it through a different

You have no doubt seen the ways in which the

   You have no doubt seen the ways in which the Supreme Court made decisions that brought about significant change for the entire country. It is also true that the Supreme Court makes decisions that affect public administration and public policy.  For this assignment, you will focus on how case

Health Sciences: Stem Cell Research

 Using analysis and argumentation, write a researched, argumentative paper in which you: Introduce the problem and its relevance to the chosen field State your position with regard to the problem Provide evidence to support your opinion Anticipate and address/refute common counter-arguments Make recommendations for further exploration or solution Develop an

What is free enterprise? (5 points) Did the student understand

What is free enterprise? (5 points) Did the student understand what free enterprise is and is not? How is it different from crony capitalism? What are the moral underpinnings of the free enterprise system? (5 points) How does free enterprise view individuals as part of society? How do interactions between

ating Disorders During Gestation: Implications for Mother’s Health, Fetal Outcomes,

  ating Disorders During Gestation: Implications for Mother’s Health, Fetal Outcomes, and Epigenetic Changes. Read the introduction, and at least one section of your own selection in the remainder of the article. Then, answer the following question: “How does maternal nutrition affect maternal and/or fetal health?” Provide specific examples. Be

Carter Hicks The subject of investing in nuclear power has

 Carter Hicks  The subject of investing in nuclear power has always been a tricky one for me. On one hand, we have plenty of evidence in support of nuclear power. It is relatively safe, clean, renewable, on paper it sounds like a great idea. On the other hand, the potential

For this Assignment, the Textbook is Attached Lesson 11 Discussion

For this Assignment, the Textbook is Attached  Lesson 11 Discussion Discuss why evidence shows that humans have a fundamental need to belong to groups. What may happen to a person if they have no affiliation with a group? Is there anything positive about having no group affiliation or does it

Governance and Fraud in Healthcare Organizations- Stark Law

Topic- Stark Law Paper will be double spaced and be 4-5 pages in 12 point New Times Roman font. Include Cover Photo 1. Name of the Law and or laws: (Stark Law) State the official title of the federal and/or state law, the statute and section number. Must be either