Answer
Option A ) myBook.isbn = "978-1449320102";
Reason :- A Book type variable myBook is created and for initializing its isbn value , isbn data member of myBook is called using (myBook.isbn) and it is initialized with the value "978-1449320102" , isbn is a string type data member, that is why double quotes are used here.
If you find this answer useful , please rate positive, thankyou
Given the following code fragment, which programming statement replaces the comment of X's with an assignment...
I
wrote this code but there’s an issue with it :
#include <iostream>
#include <vector>
#include <string>
#include <fstream>
using namespace std;
class Borrower {
private:
string ID, name;
public:
Borrower() :ID("0"), name("no name yet") {}
void setID(string nID);
void setName(string nID);
string getID();
string getName();
};
void Borrower::setID(string nID) {
ID = nID;
}
void Borrower::setName(string nname) {
name = nname;
}
string Borrower::getID() {
return ID;
}
string Borrower::getName() {
return name;
}
class Book {
private:
string...
What is the type of code in line 16? The answer is supposed to
be Object. Can someone give me an in depth explanation why?
What is the type of the code in line 16: 1 2 package app: import java.util.ArrayList; public class Controller { 3 4 5 6 7 8 public static void main(String[] args) { 9 BookBag my Bookbag = new BookBag(); Book myBook = new Book("123 of Java"); Phone myPhone = new Phone (14.2); 10 11 12...
C++
Could you check my code, it work but professor said that
there are some mistakes(check virtual functions, prin() and others,
according assignment) .
Assignment:
My code:
#include<iostream>
#include<string>
using namespace std;
class BasicShape { //Abstract base class
protected:
double area;
private:
string name;
public:
BasicShape(double a, string n) {
area=a;
name=n;
}
void virtual calcArea()=0;//Pure Virtual Function
virtual void print() {
cout<<"Area of "<<getName()<<" is:
"<<area<<"\n";
}
string getName(){
return name;
}
};
class Circle : public...
Help! Not sure how to create this java program to run efficiently. Current code and assignment attached. Assignment :Write a class Movies.java that reads in a movie list file (movies.txt). The file must contain the following fields: name, genre, and time. Provide the user with the options to sort on each field. Allow the user to continue to sort the list until they enter the exit option. ---------------------------------------------------------- import java.util.*; import java.io.*; public class Movies { String movieTitle; String movieGenre;...
C++
Programming
QUESTION 10 Based on the following C++ code, what is the output of "pvari->print(" function call? class A public void print cout << "Hello from A": 1 virtual void print2() {cout << "Hello from A2";} class B public A public void print) { cout << "Hello from B:1 virtual void print2() {cout << "Hello from B2": 1 int main() Avari Apvarl-new B; return 0; 1 o a Hello from A2 ob Hello from B O Hello from A...
This is the question about object-oriend programming(java) please show the detail comment and prefect code of each class, Thank you! This question contain 7 parts(questions) Question 1 Create a class a class Cat with the following UML diagram: (the "-" means private , "+" means public) +-----------------------------------+ | Cat | +-----------------------------------+ | - name: String | | - weight: double | +-----------------------------------+ | + Cat(String name, double weight) | | + getName(): String | | + getWeight(): double | |...
using the source code at the bottom of this page, use the following instructions to make the appropriate modifications to the source code. Serendipity Booksellers Software Development Project— Part 7: A Problem-Solving Exercise For this chapter’s assignment, you are to add a series of arrays to the program. For the time being, these arrays will be used to hold the data in the inventory database. The functions that allow the user to add, change, and delete books in the store’s...
Here is what I got so far
also can anyone help me align the output
#include <iostream>
#include <iomanip>
using namespace std;
class Person
{
private:
string name;
public:
Person()
{
name = "";
}
Person(string name)
{
this->name = name;
}
string getName()
{
return name;
}
void setName(string name)
{
this-> name = name;
}
};
class Publication
{
private:
int pubNumber;
string title;
Person borrower;
public:
static int count;
Publication()
{
title = "";
}...
In the processLineOfData, write the code to handle case "H" of the switch statement such that: An HourlyEmployee object is created using the firstName, lastName, rate, and hours local variables. Notice that rate and hours need to be converted from String to double. You may use parseDouble method of the Double class as follows: Double.parseDouble(rate) Call the parsePaychecks method in this class passing the HourlyEmployee object created in the previous step and the checks variable. Call the findDepartment method...
Programming: Java: Fixing errors in code help: The errors are in square.java and rectangle.java and they both say: constructor Shape in class Shape cannot be applied to given types; required: no arguments found: String reason: actual and formal argument lists differ in length The directions say: The files Shape.java and TestArea.java have been finished already, YOU DONT ADD ANYTHING TO THESE TWO. According to the requirement, you need to modify in Square.java and Rectangle.java, respectively a. Implementing constructor with no...