I need help doing the requirements listed below. Please don't delete comments.
#include
#include
#include
#include "Imager.h"
/// 5 points : The program compiles without errors and warnings
/// 5 points : The program operates correctly
using namespace std;
int main()
{
/// 2 points: Create an instance of two integers called "inX" and
"inY".
/// 2 points: Create an instance of the Imager class called
"myImager".
/// 2 points: Create a file input stream called "fileInStream".
/// 2 points: Open the file "message.txt" for "fileInStream".
/// 2 points: Verify that "fileInStream" open correctly. Print
a
/// error message if it does not and immediately exit the
program.
do
{
/// 2 points: Read two integers at a time from
"fileInStream".
/// Store the integer values into "inX" and then "inY"
respectively.
if(fileInStream.eof())
{
break;
}
/// 4 points: Call the append member function of "myImager".
The
/// member function, declared in ImagerBase.h, has the form
///
/// void append(int, int)
///
/// Pass the value of "inX" as the first argument and the value
of
/// "inY" as the second argument.
} while(!fileInStream.eof());
/// 2 points: Close "fileInStream"
/// 2 points: Call the "myImager" member functions :
///
/// int getWidth()
/// int getHeight()
///
/// Use the values returned from the function
/// calls to complete the call to the sf::RenderWindow below
sf::RenderWindow window(sf::VideoMode(/* ADD MISSING CODE HERE */),
"Message");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::White);
/// 4 points: Call the "window" draw function and pass
"myImagert" as the
/// argument.
window.display();
}
return 0;
}
int main()
{
/// 2 points: Create an instance of two integers called "inX" and
"inY".
int inX,inY;
/// 2 points: Create an instance of the Imager class called
"myImager".
Imager myImager;
/// 2 points: Create a file input stream called "fileInStream".
ifstream fileInStream;
/// 2 points: Open the file "message.txt" for "fileInStream".
fileInStream.open("message.txt");
/// 2 points: Verify that "fileInStream" open correctly. Print
a
/// error message if it does not and immediately exit the
program.
if(fileInStream.fail())
{
cerr<<"file cant be opened for reading";
exit(0);
}
do
{
/// 2 points: Read two integers at a time from
"fileInStream".
/// Store the integer values into "inX" and then "inY"
respectively.
fileInStream>>inX>>inY;
if(fileInStream.eof())
{
break;
}
/// 4 points: Call the append member function of "myImager".
The
/// member function, declared in ImagerBase.h, has the form
///
/// void append(int, int)
///
/// Pass the value of "inX" as the first argument and the value
of
/// "inY" as the second argument.
myImager.append(inX,inY);
} while(!fileInStream.eof());
/// 2 points: Close "fileInStream"
fileInStream.close();
/// 2 points: Call the "myImager" member functions :
///
/// int getWidth()
/// int getHeight()
//
/// Use the values returned from the function
/// calls to complete the call to the sf::RenderWindow below
sf::RenderWindow
window(sf::VideoMode(myImager.getWidth(),myImager.getHeight()),
"Message");
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::White);
/// 4 points: Call the "window" draw function and pass
"myImagert" as the
/// argument.
window.draw(myImager);
window.display();
}
return 0;
}
I need help doing the requirements listed below. Please don't delete comments. #include #include #include #include...
I need help meeting these requirements. Please don't delete comments. #ifndef IMAGER_H_INCLUDED #define IMAGER_H_INCLUDED #include "ImagerBase.h" /// 4 points: Define a class called "Imager" that inherits /// public-ly from the "ImagerBase" class { /// 4 points: Declare a public member functions called /// "getWidth" that returns an int and has no parmeters /// 4 points: Declare a public member functions called /// "getHeight" that returns an int and has no parmeters }; #endif // IMAGER_H_INCLUDED
please do in java and comments the code so i can understand Requirements: Create a Java class named “MyRectangle2D.java”. Your class will have double two variables named x and y. These will represent the center point of your rectangle. Your class will have two double variables named width and height. These will represent the width and height of your rectangle. Create getter and setter methods for x, y, width, and height. Create a “no argument” constructor for your class that...
Modify the following C code to the changes listed below. Please format code correctly. #include <stdio.h> #include <stdlib.h> #define SIZE 5 void displayData(int [], int s); void getData(int array[], int size) { for(int i=0; i<SIZE; i++) { scanf("%d", &array[i]); } } int main() { int grades[SIZE]; for(int i=0; i<SIZE; i++) { grades[i] = 0; } getData(grades,SIZE); displayData(grades, SIZE); } void displayData(int grades[], int size) { for(int i=0; i<size;...
Example program
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
vector<int> factor(int n)
{
vector <int> v1;
// Print the number of 2s that divide n
while (n%2 == 0)
{
printf("%d ", 2);
n = n/2;
v1.push_back(2);
}
// n must be odd at this point. So we can
skip
// one element (Note i = i +2)
for (int i = 3; i <=...
Please in C Language
Thank you!
The following program source code is incomplete 1 #include <stdio.h> 2 3 // TODO: 1) Add the typedef here: 5// TODO: 2) Modify the parameter of repeat to add irn the function pointer for the function to be called repeatedly: 8 void repeat (int times) for (int k 0; k < times; ++k) 12 // TODO: 3) Add the call to the function pointer here: 14 15 17 void test (void) 18 printf("Test!\n"); 19...
I need help with my homework please. I should write this program
in C++ language and use Inventory.h file (header file),
Inventory.cpp file (implementation file), and main.cpp file (main
program).
This is the program:
Demonstrate the class in a driver program. Input validation,
don’t accept negative values for item number, quantity, or
cost.
6. Inventory Class Design an Inventory class that can hold information and calculate data for items ma retail store's inventory. The class should have the following private...
Please I need help with the following questions in JAVA programming language. Please comment the code to help me understand, thanks. Exercise 1: Inheritance 1. Firstly, create and compile a simple class called Parent. Give it the following behaviour: a. A default constructor that does nothing other than print out “Parent default constructor” using System.out b. A single method called getMessage which returns a String, e.g. “Parent message” 2. Next, create and compile a class called Child. Give it the...
Write a C++ program for the instructions below. Please
read the instructions carefully and make sure they are followed
correctly.
and please put comment with code!
Problem:2 1. Class Student Create a "Hello C++! I love CS52" Program 10 points Create a program that simply outputs the text Hello C++!I love CS52" when you run it. This can be done by using cout object in the main function. 2. Create a Class and an Object In the same file as...
can someone please double check my code here are the requirements please help me fulfill the requirements Using the material in the textbook (NumberList) as a sample, design your own dynamic linked list class (using pointers) to hold a series of capital letters. The class should have the following member functions: append, insert (at a specific position, return -1 if that position doesn't exist), delete (at a specific position, return -1 if that position doesn't exist), print, reverse (which rearranges...
This is code for c++. Any help would be great. #include <iostream> using namespace std; /* 1. Create a method that prints your name */ /* 2. Create an overloaded method that takes an integer and prints it out multiplied * by itself * Print out the argument inside the method and then call the method from main * and print it out * What was the typed of passing used inhere ? */ /* 3. Create an overloaded method...