Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
	
DASC	1204	–	Programming	Project	4	
Due	Date	–	02/28/2022	at	11:59pm		
1.	Problem	Statement:		The	goal	of	this	programming	assignment	is	to	give	students	experience	with	functions	and	parameters	in	Java.	Your	task	it	to	write	a	program	that	will	allow	the	TipTopToy	Company	to	calculate	the	volume	and	mass	of	their	metal	toy	tops	consisting	of	one	cone,	one	cylinder,	and	one	half	sphere	with	the	dimensions	shown	in	the	diagram	below.		
		As	you	know,	the	volume	of	a	sphere	with	radius	r	is	given	by:		sphere_volume(𝑟) = 4	𝜋	𝑟33 		Similarly,	the	volume	of	cylinder	a	with	radius	r,	and	height	h	is	given	by:		cylinder_volume(𝑟, ℎ) = 𝜋	ℎ	𝑟<		Finally,	the	volume	of	a	cone	with	radius	r,	and	height	h	is	given	by:	cone_volume(𝑟, ℎ) = 𝜋	ℎ	𝑟<3 		For	this	assignment,	your	first	task	will	be	to	write	three	Java	functions	to	calculate	the	volumes	of	these	three	geometric	objects.	You	should	perform	error	checking	in	these	functions	to	make	sure	the	input	parameters	are	all	positive,	and	if	not	your	function	should	print	an	error	message	and	return	a	volume	of	zero.					
	Your	second	task	will	be	to	write	a	function	called	“top_volume”	that	takes	in	four	parameters	corresponding	to	the	H1,	H2,	W1,	W2	values	above.	This	function	should	call	the	three	functions	described	above	to	calculate	the	volume	of	the	toy	top.	This	function	should	also	include	error	checking	to	ensure	that	sure	the	input	parameters	are	all	positive,	and	if	not	your	function	should	print	an	error	message	and	return	a	volume	of	zero.			Your	“top_volume”	function	should	also	compare	the	volume	of	the	cone	portion	to	the	volume	of	the	cylinder/sphere	portion,	and	if	the	volume	of	the	cone	portion	is	less	than	the	volume	of	the	cylinder/sphere	portion	then	your	function	should	print	a	warning	message	that	the	top	is	“handle	heavy”	and	may	not	work	properly.		Your	next	task	will	be	to	write	a	function	called	“metal_mass”	that	takes	in	two	parameters,	the	volume	of	the	geometric	object,	and	the	name	of	the	metal.	Your	function	should	be	able	to	handle	FIVE	metals	of	your	choosing.	This	function	should	include	error	checking,	to	make	sure	the	volume	is	positive,	and	the	metal	name	is	one	of	the	five	allowed	options.	If	not,	the	function	should	print	an	error	message	and	return	a	mass	of	zero.		Your	final	task	will	be	to	write	a	very	small	main	program	that	prompts	the	user	for	the	dimensions	of	the	top	(H1,	H2,	W1,	W2)	and	the	desired	metal	type.	Your	main	program	should	then	call	the	“top_volume”	and	“metal_mass”	functions	to	calculate	and	print	the	mass	of	the	specified	top.			
2.	Design:		Your	first	task	is	to	design	the	program	input/output.	Specifically,	what	messages	you	want	to	print,	how	to	read	inputs,	how	to	print	outputs.	There	is	no	“right	way”	or	“wrong	way”	but	you	want	your	program	to	be	easy	to	use,	and	the	outputs	to	be	easy	to	understand.		Your	second	design	task	is	to	decide	on	the	names	of	the	functions,	the	names	and	data	types	of	the	parameters,	and	the	return	types	of	the	five	functions	described	above.	Students	are	NOT	allowed	to	use	global	variables	instead	of	parameters.			Your	next	design	task	will	be	to	work	out	the	logic	for	the	parameter	error	checking	described	above,	and	how	to	use	the	function	parameters	in	the	formulas	above	to	calculate	the	desired	quantities.	Students	ARE	allowed	to	reuse	their	volume	calculation	code	from	previous	assignments	as	needed.			Your	final	design	task	is	to	decide	on	what	FIVE	metals	your	program	will	support	and	look	up	the	corresponding	metal	density	values	online.	As	before,	you	are	welcome	to	use	any	units	you	want,	but	you	should	be	sure	that	your	input	prompts	and	program	output	state	the	units	you	choose.	
	
3.	Implementation:		Since	you	are	starting	with	a	"blank	piece	of	paper"	to	implement	this	project,	it	is	very	important	to	develop	your	code	incrementally	writing	comments,	adding	code,	compiling,	debugging,	a	little	bit	at	a	time.	This	way,	you	always	have	a	program	that	"does	something"	even	if	it	is	not	complete.		As	a	first	step,	it	is	always	a	good	idea	to	start	with	an	empty	main	function	and	add	the	code	to	read	input	data	from	the	user,	and	then	simply	print	these	values	back	out	again.	Once	this	part	is	working,	you	can	start	performing	calculations	with	the	input	data.		
4.	Testing:		Test	your	program	to	check	that	it	operates	correctly	for	all	requirements	listed	above.	To	verify	that	you	are	calculating	the	output	values	correctly,	you	should	try	a	variety	of	input	values	and	check	your	answers	by	hand.	You	should	SAVE	your	program	output	to	include	in	your	project	report.		You	are	not	required	to	add	error	checking	for	invalid	inputs	in	this	program,	but	it	is	always	good	to	test	a	program	to	see	what	happens	to	your	program	if	the	user	inputs	unexpected	data	(like	a	negative	number	or	“hello	mom”).	You	should	cut/paste	these	results	into	your	project	report	to	document	what	your	program	does	in	these	cases.		
5.	Documentation:		When	you	have	completed	your	Java	program,	write	a	short	report	using	the	“Programming	Project	Report	Template”	describing	what	the	objectives	were,	what	you	did,	and	the	status	of	the	program.	Does	it	work	properly	for	all	test	cases?	Are	there	any	known	problems?	Save	this	project	report	in	a	separate	document	to	be	submitted	electronically.		
6.	Project	Submission:		When	you	have	your	midpoint	code	ready	to	submit,	go	to	the	Blackboard	project	description	page	and	submit	your	program	(as	a	.java	file).	You	do	not	need	to	upload	project	documentation	for	the	midpoint.	When	you	have	completed	the	programming	project,	upload	your	final	program	(as	a	.java	file)	and	your	project	documentation	(as	a	.docx	or	.pdf	file).			The	dates	on	your	electronic	submission	will	be	used	to	verify	that	you	met	the	due	date	above.	All	late	projects	will	receive	reduced	credit:		10%	off	if	less	than	1	day	late,	20%	off	if	less	than	2	days	late,	
30%	off	if	less	than	3	days	late,	no	credit	if	more	than	3	days	late.			You	will	receive	partial	credit	for	all	programs	that	compile	even	if	they	do	not	meet	all	program	requirements,	so	handing	projects	in	on	time	is	highly	recommended.		
7.	Academic	Honesty	Statement:		Students	are	expected	to	submit	their	own	work	on	all	programming	projects,	unless	group	projects	have	been	explicitly	assigned.	Students	are	NOT	allowed	to	distribute	code	to	each	other	or	copy	code	from	another	individual	or	website.	Students	ARE	allowed	to	use	any	materials	on	the	class	website,	or	in	the	textbook,	or	ask	the	instructor	and/or	GTAs	for	assistance.		This	course	will	be	using	highly	effective	program	comparison	software	to	calculate	the	similarity	of	all	programs	to	each	other,	and	to	homework	assignments	from	previous	semesters.	Please	do	not	be	tempted	to	plagiarize	from	another	student.		Violations	of	the	policies	above	will	be	reported	to	the	provost’s	office	and	may	result	in	a	ZERO	on	the	programming	project,	an	F	in	the	class,	or	suspension	from	the	university,	depending	on	the	severity	of	the	violation	and	any	history	of	prior	violations.